本文整理汇总了PHP中cls_mysql::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP cls_mysql::connect方法的具体用法?PHP cls_mysql::connect怎么用?PHP cls_mysql::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cls_mysql
的用法示例。
在下文中一共展示了cls_mysql::connect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: urldecode
function &db()
{
include_once 'db.php';
static $db = null;
if ($db === null) {
$cfg = parse_url(DB_CONFIG);
if ($cfg['scheme'] == 'mysql') {
if (empty($cfg['pass'])) {
$cfg['pass'] = '';
} else {
$cfg['pass'] = urldecode($cfg['pass']);
}
$cfg['user'] = urldecode($cfg['user']);
if (empty($cfg['path'])) {
trigger_error('Invalid database name.', E_USER_ERROR);
} else {
$cfg['path'] = str_replace('/', '', $cfg['path']);
}
$charset = 'utf8';
$db = new cls_mysql();
//$db->cache_dir = ROOT_PATH. '/temp/query_caches/';
$db->connect($cfg['host'] . ':' . $cfg['port'], $cfg['user'], $cfg['pass'], $cfg['path'], $charset);
} else {
trigger_error('Unkown database type.', E_USER_ERROR);
}
}
return $db;
}
示例2: array
}
if (!trim($settings['uc_key'])) {
$error = true;
$sysmsg[] = __('uc_key_error');
}
if (!trim($settings['uc_api'])) {
$error = true;
$sysmsg[] = __('uc_api_error');
}
if (!$settings['uc_appid']) {
$error = true;
$sysmsg[] = __('uc_appid_error');
}
if ($settings['connect_uc'] && !$error) {
$dbuc = new cls_mysql();
$dbuc->connect($settings['uc_dbhost'], $settings['uc_dbuser'], $settings['uc_dbpwd'], $settings['uc_dbname'], $settings['uc_pconnect']);
$username = @$dbuc->result_first("select username from `{$settings['uc_dbname']}`.{$settings['uc_dbtablepre']}members where username='{$settings['uc_admin']}' limit 1");
if ($q) {
$dbuc->free($q);
}
$dbuc->close();
if (!$username) {
$error = true;
$sysmsg[] = __('uc_admin_error');
}
}
if (!$error) {
$charset_arr = array('gbk' => 'gbk', 'utf-8' => 'utf8');
$settings['uc_dbcharset'] = $charset_arr[strtolower($settings['uc_charset'])];
settings_cache($settings);
$str = "<?php" . LF . LF;
示例3: time
<?php
error_reporting(0);
//error_reporting(2047);
define('M_COM', TRUE);
define('M_ROOT', '');
$timestamp = time();
include_once M_ROOT . './base.inc.php';
include_once M_ROOT . './include/general.fun.php';
load_cache('sitemaps');
empty($sitemaps['google']) && exit;
$sitemap = $sitemaps['google'];
$cachefile = M_ROOT . './google.xml';
if (empty($sitemap['setting']['life']) || $timestamp - @filemtime($cachefile) > $sitemap['setting']['life'] * 3600 || !($datastr = file2str($cachefile))) {
require M_ROOT . './dynamic/cache/mconfigs.cac.php';
@extract($mconfigs_0);
include_once M_ROOT . './include/mysql.cls.php';
$db = new cls_mysql();
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset);
include_once M_ROOT . './include/common.fun.php';
include_once M_ROOT . './include/sitemap.inc.php';
str2file($datastr, $cachefile);
}
echo $datastr;
header("Content-type: application/xml");
exit;
示例4: elseif
} elseif ($action == 'dbcheck') {
$checkmsg = '';
$dbsourcenew = mstripslashes($dbsourcenew);
if (in_str('********', $dbsourcenew['dbpw'])) {
$dbsourcenew['dbpw'] = authcode($dbsourcenew['dbpw0'], 'DECODE', md5($authkey));
}
$alertarr = array('add' => array('dbsourceadd', 'dbsourcesedit'), 'edit' => array('dbsourcedetail', 'dbsourcedetail'));
$dbsourcenew['cname'] = trim(strip_tags($dbsourcenew['cname']));
$dbsourcenew['dbhost'] = trim(strip_tags($dbsourcenew['dbhost']));
$dbsourcenew['dbuser'] = trim(strip_tags($dbsourcenew['dbuser']));
$dbsourcenew['dbname'] = trim(strip_tags($dbsourcenew['dbname']));
if (empty($dbsourcenew['cname']) || empty($dbsourcenew['dbhost']) || empty($dbsourcenew['dbuser']) || empty($dbsourcenew['dbname'])) {
$checkmsg = lang('dbsrc_data_miss');
} else {
$s_db = new cls_mysql();
if (!$s_db->connect($dbsourcenew['dbhost'], $dbsourcenew['dbuser'], $dbsourcenew['dbpw'], $dbsourcenew['dbname'], 0, false, $dbsourcenew['dbcharset'])) {
$checkmsg = lang('dbsrc_connect_error');
} else {
$checkmsg = lang('dbsrc_connect_correct');
}
$s_db->close();
}
echo '<script language="javascript" reload="1">alert(\'' . addslashes($checkmsg) . '\');parent.$(\'' . $alertarr[$deal][0] . '\').action=\'?entry=dbsources&action=' . $alertarr[$deal][1] . '\';parent.$(\'' . $alertarr[$deal][0] . '\').target=\'_self\'</script>';
} elseif ($action == 'mailcheck') {
$mail_to = trim($mconfigsnew['mail_to']);
$mail_sign = trim($mconfigsnew['mail_sign']);
$mail_smtp = trim($mconfigsnew['mail_smtp']);
$mail_mode = trim($mconfigsnew['mail_mode']);
$mail_port = trim($mconfigsnew['mail_port']);
$mail_auth = trim($mconfigsnew['mail_auth']);
$mail_from = trim($mconfigsnew['mail_from']);
示例5: foreach
$error[] = '请填写博客名字';
}
if ($error) {
echo '<p class="line">错误信息</p>';
foreach ($error as $val) {
echo "<p>{$val}</p>";
}
exit;
}
$dbhost = $_POST['host'];
$dbuser = $_POST['dbuser'];
$dbpw = $_POST['dbpass'];
$dbname = $_POST['dbname'];
$charset = 'utf8';
$db = new cls_mysql();
if ($db->connect($dbhost, $dbuser, $dbpw, $dbname, $charset, $pconnect)) {
$error[] = '数据库连接错误';
}
if (empty($_POST['dbprefix'])) {
$dbprefix = 'fb_';
} else {
$dbprefix = $_POST['dbprefix'];
}
$admin_user = $_POST['admin_user'];
$admin_pass = $_POST['admin_pass'];
$blogname = $_POST['blogname'];
$blogdesc = $_POST['blogdesc'];
$blog_keyword = $_POST['blogkeyword'];
$domain = dirname(url());
$domain = str_replace("install", '', $domain);
$cookie_path = '/';