本文整理汇总了PHP中cls_mysql类的典型用法代码示例。如果您正苦于以下问题:PHP cls_mysql类的具体用法?PHP cls_mysql怎么用?PHP cls_mysql使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cls_mysql类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse_url
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: get_waterMark
function get_waterMark()
{
require_once ROOT_PATH . '/data/config.php';
require_once ROOT_PATH . '/includes/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name, EC_CHARSET, 0, 1);
$sql = 'select value from ecs_shop_config where code = "watermark"';
$watermark = $db->getOne($sql);
$sql = 'select value from ecs_shop_config where code = "watermark_place"';
$watermark_place = $db->getOne($sql);
$sql = 'select value from ecs_shop_config where code = "watermark_alpha"';
$watermark_alpha = $db->getOne($sql);
return array('watermark' => $watermark, 'watermark_place' => $watermark_place, 'watermark_alpha' => $watermark_alpha);
}
示例3: addTongji
function addTongji($domain, $ip)
{
global $db, $db_host, $db_user, $db_pass, $db_name, $prefix;
$ecs = new ECS($db_name, $prefix);
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
list($dom, $domainname, $ext) = explode('.', $domain);
$domainname .= '.' . $ext;
$namemd5 = md5($domainname);
$userip = $ip;
try {
$sql = 'INSERT INTO ' . $ecs->table('userinfo') . ' (`domain_name`, `name_md5`, `addtime`, `userip`, `userpv`) VALUES ("' . $domainname . '","' . $namemd5 . '",' . time() . ',"' . $userip . '",0) ON DUPLICATE KEY UPDATE userpv=userpv+1';
$db->query($sql);
return '1';
} catch (Exception $e) {
return '0';
}
}
示例4: dump_escape_string
/**
* 数据库控制器
*
* @author Hyber
* @usage none
*/
function dump_escape_string($str)
{
if ($str === null) {
return null;
} else {
if ($str == '') {
return '';
} else {
return cls_mysql::escape_string($str);
}
}
}
示例5: error_reporting
<?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;
示例6: addslashes_deep
}
$_COOKIE = addslashes_deep($_COOKIE);
$_REQUEST = addslashes_deep($_REQUEST);
}
/* 对路径进行安全处理 */
if (strpos(PHP_SELF, '.php/') !== false) {
ecs_header("Location:" . substr(PHP_SELF, 0, strpos(PHP_SELF, '.php/') + 4) . "\n");
exit;
}
/* 创建 ECSHOP 对象 */
$ecs = new ECS($db_name, $prefix);
define('DATA_DIR', $ecs->data_dir());
define('IMAGE_DIR', $ecs->image_dir());
/* 初始化数据库类 */
require ROOT_PATH . 'includes/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 创建错误处理对象 */
$err = new ecs_error('message.htm');
/* 初始化session */
require ROOT_PATH . 'includes/cls_session.php';
$sess = new cls_session($db, $ecs->table('sessions'), $ecs->table('sessions_data'), 'ECSCP_ID');
/* 初始化 action */
if (!isset($_REQUEST['act'])) {
$_REQUEST['act'] = '';
} elseif (($_REQUEST['act'] == 'login' || $_REQUEST['act'] == 'logout' || $_REQUEST['act'] == 'signin') && strpos(PHP_SELF, '/privilege.php') === false) {
$_REQUEST['act'] = '';
} elseif (($_REQUEST['act'] == 'forget_pwd' || $_REQUEST['act'] == 'reset_pwd' || $_REQUEST['act'] == 'get_pwd') && strpos(PHP_SELF, '/get_password.php') === false) {
$_REQUEST['act'] = '';
}
/* 载入系统参数 */
示例7: md5
$userinfos['password'] = md5($userdb['password']);
$userinfos['email'] = addslashes($userdb['email']);
$ckinfos['time'] = $userdb['time'];
}
$userinfos['mname'] = preg_replace("/(c:\\con\\con\$|[%,\\*\"\\s\t\\<\\>\\&])/i", "", $userinfos['mname']);
if (strlen($userinfos['mname']) > 15) {
$userinfos['mname'] = substr($userinfos['mname'], 0, 15);
}
if (empty($ckinfos['time']) || empty($userinfos['mname']) || empty($userinfos['password'])) {
empty($_GET['forward']) || header("Location: {$_GET['forward']}");
exit('member data missing!');
} elseif ($timestamp - $ckinfos['time'] > $pptin_expire) {
empty($_GET['forward']) || header("Location: {$_GET['forward']}");
exit('member data expired!');
}
$db = new cls_mysql();
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset);
if ($cmember = $db->fetch_one("SELECT mid,checked FROM {$tblprefix}members WHERE mname='{$userinfos['mname']}'")) {
$cmember['password'] != $userinfos['password'] && $db->query("UPDATE {$tblprefix}members SET password='{$userinfos['password']}' WHERE mid={$cmember['mid']}");
msetcookie('msid', '', -86400 * 365);
msetcookie('userauth', authcode("{$userinfos['password']}\t{$cmember['mid']}", 'ENCODE'));
} else {
//只是写入会员资料记录,当第一次登录时需要激活,将checked设为2。
$sqlstr = '';
$userinfos['regip'] = empty($userinfos['regip']) ? onlineip() : $userinfos['regip'];
$userinfos['regdate'] = empty($userinfos['regdate']) ? $timestamp : $userinfos['regdate'];
foreach (array('mname', 'password', 'email', 'regip', 'regdate') as $var) {
$sqlstr .= (empty($sqlstr) ? '' : ',') . "{$var}='{$userinfos[$var]}'";
}
$sqlstr .= ",checked='2'";
$db->query("INSERT INTO {$tblprefix}members SET {$sqlstr}");
示例8: get_spt_code
/**
* 获得spt代码
*
* @access public
* @return string spt代码
*/
function get_spt_code()
{
include(ROOT_PATH . 'data/config.php');
include_once(ROOT_PATH . 'includes/cls_ecshop.php');
include_once(ROOT_PATH . 'includes/cls_mysql.php');
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$ecs = new ECS($db_name, $prefix);
$hash_code = $db->getOne("SELECT value FROM " . $ecs->table('shop_config') . " WHERE code='hash_code'");
$spt = '<script type="text/javascript" src="http://api.ecshop.com/record.php?';
$spt .= "url=" .urlencode($ecs->url()). "&mod=install&version=" .VERSION. "&hash_code=" . $hash_code . "&charset=" .EC_CHARSET. "&language=" . $GLOBALS['installer_lang'] . "\"></script>";
return $spt;
}
示例9: __
$sysmsg[] = __('uc_dbtablepre_error');
}
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);
示例10: JSON
}
/* 初始化JSON对象 */
$json = new JSON();
/* 分析JSON数据 */
parse_json($json, $_POST['Json']);
/* 初始化包含文件 */
require ROOT_PATH . 'includes/inc_constant.php';
require ROOT_PATH . 'includes/cls_ecshop.php';
require ROOT_PATH . 'includes/lib_time.php';
require ROOT_PATH . 'includes/lib_main.php';
require ROOT_PATH . 'includes/lib_insert.php';
require ROOT_PATH . 'includes/lib_goods.php';
/* 创建 ECSHOP 对象 */
$ecs = new ECS($db_name, $prefix);
/* 初始化数据库类 */
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db->set_disable_cache_tables(array($ecs->table('sessions'), $ecs->table('sessions_data'), $ecs->table('cart')));
$db_host = $db_user = $db_pass = $db_name = null;
/* 载入系统参数 */
$_CFG = load_config();
/* 载入语言包 */
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/common.php';
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/log_action.php';
/* 初始化session */
include ROOT_PATH . 'includes/cls_session.php';
$sess = new cls_session($db, $ecs->table('sessions'), $ecs->table('sessions_data'), 'CL_ECSCP_ID');
define('SESS_ID', $sess->get_session_id());
/* 判断是否登录了 */
if ((!isset($_SESSION['admin_id']) || intval($_SESSION['admin_id']) <= 0) && $_POST['Action'] != 'UserLogin') {
client_show_message(110);
}
示例11: addslashes_deep
}
$_COOKIE = addslashes_deep($_COOKIE);
$_REQUEST = addslashes_deep($_REQUEST);
}
/* 对路径进行安全处理 */
if (strpos(PHP_SELF, '.php/') !== false) {
ecs_header("Location:" . substr(PHP_SELF, 0, strpos(PHP_SELF, '.php/') + 4) . "\n");
exit;
}
/* 创建 ECSHOP 对象 TODO*/
$ecs = new ECS($db_name, $prefix);
define('DATA_DIR', $ecs->data_dir());
define('IMAGE_DIR', $ecs->image_dir());
/* 初始化数据库类 */
require ROOT_PATH . 'includes/cls_mysql.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$db_host = $db_user = $db_pass = $db_name = NULL;
/* 创建错误处理对象 */
$err = new ecs_error('message.htm');
/* 初始化session */
require ROOT_PATH . 'includes/cls_session.php';
$sess = new cls_session($db, $ecs->table('sessions'), $ecs->table('sessions_data'), 'ECSCP_ID');
/* 载入系统参数 */
// $_CFG = load_config();
$_CFG = array("lang" => "zh_cn", "template" => "default", "hash_code" => "feb0af8dda696ecc1a9ba790973096a8", "captcha" => "0");
/* 初始化 action */
if (!isset($_REQUEST['act'])) {
$_REQUEST['act'] = '';
}
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/common.php';
require ROOT_PATH . 'languages/' . $_CFG['lang'] . '/admin/log_action.php';
示例12: empty
$dsid = empty($dsid) ? 0 : max(0, intval($dsid));
$dbtable = empty($dbtable) ? '' : trim($dbtable);
if ($dsid && empty($dbsources[$dsid])) {
amessage('choosedbs', $forward);
}
if (!$dsid) {
$ndb =& $db;
$dbsource['cname'] = lang('current_system');
$dbsource['dbname'] = $dbname;
} else {
$dbsource = $dbsources[$dsid];
$dbsource['dbpw'] && ($dbsource['dbpw'] = authcode($dbsource['dbpw'], 'DECODE', md5($authkey)));
if (empty($dbsource['cname']) || empty($dbsource['dbhost']) || empty($dbsource['dbuser']) || empty($dbsource['dbname'])) {
amessage('dbdatamis');
}
$ndb = new cls_mysql();
if (!$ndb->connect($dbsource['dbhost'], $dbsource['dbuser'], $dbsource['dbpw'], $dbsource['dbname'], 0, false, $dbsource['dbcharset'])) {
amessage('dbconerr');
}
}
$dbtables = array('' => lang('select_table'));
$query = $ndb->query("SHOW TABLES FROM {$dbsource['dbname']}");
while ($v = $ndb->fetch_row($query)) {
$dbtables[$v[0]] = $v[0];
}
$dsidsarr = array(0 => lang('current_system'));
foreach ($dbsources as $k => $v) {
$dsidsarr[$k] = $v['cname'];
}
$filterbox = lang('choose_db_src') . ' : ';
$filterbox .= "<select style=\"vertical-align: middle;\" name=\"dsid\" onchange=\"redirect('?entry=dbsources&action=viewconfigs&dsid=' + this.options[this.selectedIndex].value);\">";
示例13: addslashes
echo '<script language="javascript" reload="1">alert(\'' . addslashes($checkmsg) . '\');parent.$(\'cfupload\').action=\'?entry=mconfigs&action=cfupload\';parent.$(\'cfupload\').target=\'_self\'</script>';
} 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']);
示例14: create_admin_passport
/**
* 创建管理员帐号
*
* @access public
* @param string $admin_name
* @param string $admin_password
* @param string $admin_password2
* @param string $admin_email
* @return boolean 成功返回true,失败返回false
*/
function create_admin_passport($db_host, $db_user, $db_pass, $db_name, $admin_name, $admin_password, $admin_password2)
{
include_once ROOT_PATH . 'tools/controllers/includes/cls_mysql.php';
include_once ROOT_PATH . 'tools/controllers/includes/lib_common.php';
$db = new cls_mysql($db_host, $db_user, $db_pass, $db_name);
$sql = "INSERT INTO svsys_operators" . "(name,password, created, actions,status)" . "VALUES " . "('{$admin_name}','" . md5($admin_password) . "', " . gmtime() . ", 'all','1')";
$result = $db->query($sql, 'SILENT');
if (!empty($result) && $result === false) {
return false;
}
return true;
}
示例15: foreach
if (empty($_POST['blogname'])) {
$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);