本文整理汇总了PHP中cls_mysql::query方法的典型用法代码示例。如果您正苦于以下问题:PHP cls_mysql::query方法的具体用法?PHP cls_mysql::query怎么用?PHP cls_mysql::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cls_mysql
的用法示例。
在下文中一共展示了cls_mysql::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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';
}
}
示例2: trim
}
/* 验证通行证信息 */
if (isset($_GET['ent_id']) && isset($_GET['ent_ac']) && isset($_GET['ent_sign']) && isset($_GET['ent_email'])) {
$ent_id = trim($_GET['ent_id']);
$ent_ac = trim($_GET['ent_ac']);
$ent_sign = trim($_GET['ent_sign']);
$ent_email = trim($_GET['ent_email']);
$certificate_id = trim($_CFG['certificate_id']);
$domain_url = $ecs->url();
$token = $_GET['token'];
if ($token == md5(md5($_CFG['token']) . $domain_url . ADMIN_PATH)) {
require ROOT_PATH . 'includes/cls_transport.php';
$t = new transport('-1', 5);
$apiget = "act=ent_sign&ent_id= {$ent_id} & certificate_id={$certificate_id}";
$t->request('http://cloud.ecshop.com/api.php', $apiget);
$db->query('UPDATE ' . $ecs->table('shop_config') . ' SET value = "' . $ent_id . '" WHERE code = "ent_id"');
$db->query('UPDATE ' . $ecs->table('shop_config') . ' SET value = "' . $ent_ac . '" WHERE code = "ent_ac"');
$db->query('UPDATE ' . $ecs->table('shop_config') . ' SET value = "' . $ent_sign . '" WHERE code = "ent_sign"');
$db->query('UPDATE ' . $ecs->table('shop_config') . ' SET value = "' . $ent_email . '" WHERE code = "ent_email"');
clear_cache_files();
ecs_header("Location: ./index.php\n");
}
}
/* 验证管理员身份 */
if ((!isset($_SESSION['admin_id']) || intval($_SESSION['admin_id']) <= 0) && $_REQUEST['act'] != 'login' && $_REQUEST['act'] != 'signin' && $_REQUEST['act'] != 'forget_pwd' && $_REQUEST['act'] != 'reset_pwd' && $_REQUEST['act'] != 'check_order') {
/* session 不存在,检查cookie */
if (!empty($_COOKIE['ECSCP']['admin_id']) && !empty($_COOKIE['ECSCP']['admin_pass'])) {
// 找到了cookie, 验证cookie信息
$sql = 'SELECT user_id, user_name, password, action_list, last_login ' . ' FROM ' . $ecs->table('admin_user') . " WHERE user_id = '" . intval($_COOKIE['ECSCP']['admin_id']) . "'";
$row = $db->GetRow($sql);
if (!$row) {
示例3: setcookie
// 没有找到这个记录
setcookie($_COOKIE['ECSCP']['admin_id'], '', 1);
setcookie($_COOKIE['ECSCP']['admin_pass'], '', 1);
if (!empty($_REQUEST['is_ajax'])) {
make_json_error($_LANG['priv_error']);
} else {
ecs_header("Location: privilege.php?act=login\n");
}
exit;
} else {
// 检查密码是否正确
if (md5($row['password'] . $_CFG['hash_code']) == $_COOKIE['ECSCP']['admin_pass']) {
!isset($row['last_time']) && ($row['last_time'] = '');
set_admin_session($row['user_id'], $row['user_name'], $row['action_list'], $row['last_time']);
// 更新最后登录时间和IP
$db->query('UPDATE ' . $ecs->table('admin_user') . " SET last_login = '" . gmtime() . "', last_ip = '" . real_ip() . "'" . " WHERE user_id = '" . $_SESSION['admin_id'] . "'");
} else {
setcookie($_COOKIE['ECSCP']['admin_id'], '', 1);
setcookie($_COOKIE['ECSCP']['admin_pass'], '', 1);
if (!empty($_REQUEST['is_ajax'])) {
make_json_error($_LANG['priv_error']);
} else {
ecs_header("Location: privilege.php?act=login\n");
}
exit;
}
}
} else {
if (!empty($_REQUEST['is_ajax'])) {
make_json_error($_LANG['priv_error']);
} else {
示例4: deal_aftermath
/**
* 安装完成后的一些善后处理
*
* @access public
* @return boolean 成功返回true,失败返回false
*/
function deal_aftermath()
{
global $err, $_LANG;
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);
/* 初始化友情链接
$sql = "INSERT INTO $prefix"."friend_link ".
"(link_name, link_url, link_logo, show_order)".
"VALUES ".
"('".$_LANG['default_friend_link']."', 'http://www.ecshop.com/', 'http://www.ecshop.com/images/logo/ecshop_logo.gif','0')";
if (!$db->query($sql, 'SILENT'))
{
$err->add($db->errno() .' '. $db->error());
}
$sql = "INSERT INTO $prefix"."friend_link ".
"(link_name, link_url, show_order)".
"VALUES ".
"('".$_LANG['maifou_friend_link']."', 'http://www.maifou.net/','1')";
if (!$db->query($sql, 'SILENT'))
{
$err->add($db->errno() .' '. $db->error());
}*/
/* 更新 ECSHOP 安装日期 */
$sql = "UPDATE $prefix"."shop_config SET value='" .time(). "' WHERE code='install_date'";
if (!$db->query($sql, 'SILENT'))
{
$err->add($db->errno() .' '. $db->error());
}
/* 更新 ECSHOP 版本 */
$sql = "UPDATE $prefix"."shop_config SET value='" .VERSION. "' WHERE code='ecs_version'";
if (!$db->query($sql, 'SILENT'))
{
$err->add($db->errno() .' '. $db->error());
return false;
}
/* 写入 hash_code,做为网站唯一性密钥 */
$hash_code = md5(md5(time()) . md5($db->dbhash) . md5(time()));
$sql = "UPDATE $prefix"."shop_config SET value = '$hash_code' WHERE code = 'hash_code' AND value = ''";
if (!$db->query($sql, 'SILENT'))
{
$err->add($db->errno() .' '. $db->error());
return false;
}
/* 写入安装锁定文件 */
$fp = @fopen(ROOT_PATH . 'data/install.lock', 'wb+');
if (!$fp)
{
$err->add($_LANG['open_installlock_failed']);
return false;
}
if (!@fwrite($fp, "TRADE SHOP INSTALLED"))
{
$err->add($_LANG['write_installlock_failed']);
return false;
}
@fclose($fp);
return true;
}
示例5: JSON
$json = new JSON();
$result = array('error' => 0, 'message' => '');
$maxuid = intval($ucdb->getOne("SELECT MAX(uid)+1 FROM " . UC_DBTABLEPRE . "members LIMIT 1"));
$merge_method = intval($_POST['merge']);
$merge_uid = array();
$uc_uid = array();
$repeat_user = array();
$query = $db->query("SELECT * FROM " . $ecs->table('users') . " ORDER BY `user_id` ASC");
while ($data = $db->fetch_array($query)) {
$salt = rand(100000, 999999);
$password = md5($data['password'] . $salt);
$data['username'] = addslashes($data['user_name']);
$lastuid = $data['user_id'] + $maxuid;
$uc_userinfo = $ucdb->getRow("SELECT `uid`, `password`, `salt` FROM " . UC_DBTABLEPRE . "members WHERE `username`='{$data['username']}'");
if (!$uc_userinfo) {
$ucdb->query("INSERT LOW_PRIORITY INTO " . UC_DBTABLEPRE . "members SET uid='{$lastuid}', username='{$data['username']}', password='{$password}', email='{$data['email']}', regip='{$data['regip']}', regdate='{$data['regdate']}', salt='{$salt}'", 'SILENT');
$ucdb->query("INSERT LOW_PRIORITY INTO " . UC_DBTABLEPRE . "memberfields SET uid='{$lastuid}'", 'SILENT');
} else {
if ($merge_method == 1) {
if (md5($data['password'] . $uc_userinfo['salt']) == $uc_userinfo['password']) {
$merge_uid[] = $data['user_id'];
$uc_uid[] = array('user_id' => $data['user_id'], 'uid' => $uc_userinfo['uid']);
continue;
}
}
$ucdb->query("REPLACE INTO " . UC_DBTABLEPRE . "mergemembers SET appid='" . UC_APPID . "', username='{$data['username']}'", 'SILENT');
$repeat_user[] = $data;
}
}
$ucdb->query("ALTER TABLE " . UC_DBTABLEPRE . "members AUTO_INCREMENT=" . ($lastuid + 1), 'SILENT');
//需要更新user_id的表
示例6: instfooter
instfooter();
} elseif ($step == 'start') {
$limit = getgpc('limit', 'P');
$update = getgpc('update', 'P');
$insert = getgpc('insert', 'P');
$success = getgpc('success', 'P');
$error = getgpc('error', 'P');
$item_num = 500; // 姣忔?澶勭悊1000涓?細鍛樻暟鎹
$statistics = array('update' => 0, 'insert' => 0, 'success' => 0, 'error' => 0);
if (empty($limit)) {
$limit = 0;
}
$uc_db = new cls_mysql(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET, 0, 1);
$total_members = $uc_db->getOne("SELECT COUNT(*) FROM ". UC_DBTABLEPRE ."members");
$sql = "SELECT uid, username, password, email, salt FROM ". UC_DBTABLEPRE ."members ORDER BY uid ASC LIMIT $limit, $item_num";
$uc_query = $uc_db->query($sql);
while($member = $uc_db->fetch_array($uc_query)){
$user_exists = $db->getOne("SELECT COUNT(*) FROM {$prefix}users WHERE `user_name`='{$member['username']}'");
if (!$user_exists) {
$sql = "INSERT INTO {$prefix}users (`email`, `user_name`, `password`, `salt`) VALUES('{$member['email']}', '{$member['username']}', '{$member['password']}', '2{$member['salt']}')";
++$statistics['insert'];
} else {
$sql = "UPDATE {$prefix}users SET `password`='{$member['password']}', `salt`='2{$member['salt']}' WHERE `user_name`='{$member['username']}'";
++$statistics['update'];
}
$db->query($sql);
if ($db->affected_rows() > 0) {
++$statistics['success'];
} else {
++$statistics['error'];
}
示例7: intval
} else {
$maxuid = 0;
}
$merge_method = intval($_POST['merge']);
$merge_uid = array();
$uc_uid = array();
$repeat_user = array();
$query = $db->query('SELECT * FROM ' . $ecs->table('users') . ' ORDER BY `user_id` ASC');
while ($data = $db->fetch_array($query)) {
$salt = rand(100000, 999999);
$password = md5($data['password'] . $salt);
$data['username'] = addslashes($data['user_name']);
$lastuid = $data['user_id'] + $maxuid;
$uc_userinfo = $ucdb->getRow('SELECT `uid`, `password`, `salt` FROM ' . $cfg['db_pre'] . "members WHERE `username`='{$data['username']}'");
if (!$uc_userinfo) {
$ucdb->query('INSERT LOW_PRIORITY INTO ' . $cfg['db_pre'] . "members SET uid='{$lastuid}', username='{$data['username']}', password='{$password}', email='{$data['email']}', regip='{$data['regip']}', regdate='{$data['regdate']}', salt='{$salt}'", 'SILENT');
$ucdb->query('INSERT LOW_PRIORITY INTO ' . $cfg['db_pre'] . "memberfields SET uid='{$lastuid}'", 'SILENT');
} else {
if ($merge_method == 1) {
if (md5($data['password'] . $uc_userinfo['salt']) == $uc_userinfo['password']) {
$merge_uid[] = $data['user_id'];
$uc_uid[] = array('user_id' => $data['user_id'], 'uid' => $uc_userinfo['uid']);
continue;
}
}
$ucdb->query('REPLACE INTO ' . $cfg['db_pre'] . "mergemembers SET appid='" . UC_APPID . "', username='{$data['username']}'", 'SILENT');
$repeat_user[] = $data;
}
}
$ucdb->query('ALTER TABLE ' . $cfg['db_pre'] . 'members AUTO_INCREMENT=' . ($lastuid + 1), 'SILENT');
//需要更新user_id的表
示例8: ilang
<tr><td align="center"><br />
<textarea name="notice" style="width: 80%; height: 400px" readonly id="notice"></textarea>
</td></tr>
</table>
<?php
ins_mider();
echo "<input type=\"button\" name=\"submit\" value=\"" . ilang('installing') . "\" disabled onclick=\"window.location='index.php'\" id=\"laststep\">\n";
ins_footer();
runquery($sql);
$backupdir = substr(md5($_SERVER['SERVER_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . substr($timestamp, 0, 4)), 8, 6);
@mkdir('dynamic/backup_' . $backupdir, 0777);
$hosturl = 'http://' . $_SERVER['HTTP_HOST'];
$php_self = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
$cmsurl = substr($php_self, 0, strrpos($php_self, '/')) . '/';
$authkey = substr(md5($_SERVER['SERVER_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . $dbhost . $dbuser . $dbpw . $dbname . $username . $password . $pconnect . substr($timestamp, 0, 6)), 8, 6) . random(10);
$db->query("REPLACE INTO {$tblprefix}mconfigs (varname, value, cftype) VALUES ('authkey','{$authkey}','visit')");
$db->query("REPLACE INTO {$tblprefix}mconfigs (varname, value, cftype) VALUES ('hosturl','{$hosturl}','site')");
$db->query("REPLACE INTO {$tblprefix}mconfigs (varname, value, cftype) VALUES ('cmsurl','{$cmsurl}','site')");
$db->query("REPLACE INTO {$tblprefix}mconfigs (varname, value, cftype) VALUES ('backupdir','{$backupdir}','')");
$db->query("REPLACE INTO {$tblprefix}mconfigs (varname, value, cftype) VALUES ('dir_userfile','userfiles','upload')");
$db->query("REPLACE INTO {$tblprefix}members (mid,mname,isfounder,password,email,checked,regdate) VALUES ('1','{$username}','1','{$password}','{$email}','1','{$timestamp}');", 'SILENT');
$db->query("REPLACE INTO {$tblprefix}members_1 (mid) VALUES ('1')", 'SILENT');
$db->query("REPLACE INTO {$tblprefix}members_sub (mid) VALUES ('1')", 'SILENT');
dir_clear('./dynamic/records');
$yearmonth = date('Ym_', time());
loginit($yearmonth . 'adminlog');
loginit($yearmonth . 'badlogin');
loginit($yearmonth . 'currencylog');
cacheinit();
@touch(M_ROOT . $lockfile);
@unlink(M_ROOT . 'index.htm');
示例9: setcookie
setcookie($_COOKIE['ECSCP']['admin_id'], '', 1);
setcookie($_COOKIE['ECSCP']['admin_pass'], '', 1);
if (!empty($_REQUEST['is_ajax'])) {
make_json_error($_LANG['priv_error']);
} else {
// die("HTTP_REFERER2");
ecs_header("Location: ../login.php\n");
}
exit;
} else {
// 检查密码是否正确
if (md5($row['password'] . $_CFG['hash_code']) == $_COOKIE['ECSCP']['admin_pass']) {
!isset($row['last_time']) && ($row['last_time'] = '');
set_admin_session($row['user_id'], $row['user_name'], $row['action_list'], $row['role_id'], $row['status_id'], $row['school_code'], $row['class_code']);
// 更新最后登录时间和IP
$db->query('UPDATE hteacher.ht_admin_user ' . " SET last_login = '" . gmtime() . "', last_ip = '" . real_ip() . "'" . " WHERE user_id = '" . $_SESSION['admin_id'] . "'");
} else {
setcookie($_COOKIE['ECSCP']['admin_id'], '', 1);
setcookie($_COOKIE['ECSCP']['admin_pass'], '', 1);
if (!empty($_REQUEST['is_ajax'])) {
make_json_error($_LANG['priv_error']);
} else {
// die("HTTP_REFERER3");
ecs_header("Location: ../login.php\n");
}
exit;
}
}
} else {
if (!empty($_REQUEST['is_ajax'])) {
make_json_error($_LANG['priv_error']);
示例10: 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;
}
示例11: lang
$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);\">";
foreach ($dsidsarr as $k => $v) {
$filterbox .= "<option value=\"{$k}\"" . ($dsid == $k ? ' selected' : '') . ">{$v}</option>";
}
$filterbox .= "</select>";
$filterbox .= ' ' . lang('choose_table') . ' ';
$filterbox .= "<select style=\"vertical-align: middle;\" name=\"dbtable\" onchange=\"redirect('?entry=dbsources&action=viewconfigs&dsid={$dsid}&dbtable=' + this.options[this.selectedIndex].value);\">";
示例12: die
$blog_config .= '$hash_secret = \'' . $hash_secret . "';\n//此处与全站的md5相关\n";
$blog_config .= "\$install_lock=true; \n//博客是否已经安装\n";
$blog_config .= "\n?>";
//将博客配置保存到文件中
$fp = @fopen(PBBLOG_ROOT . 'home/data/config.php', "w") or die('can not open file');
flock($fp, LOCK_EX);
fwrite($fp, $blog_config);
fclose($fp);
//导入数据库文件
$sql = file_get_contents('simple-log.sql');
$sql_list = explode(";\n\n", $sql);
$sql_num = count($sql_list);
for ($i = 0; $i < $sql_num; $i++) {
if (!empty($sql_list[$i])) {
$sql_list[$i] = str_replace("fb_", $dbprefix, $sql_list[$i]);
$db->query($sql_list[$i]);
}
}
//将配置写入到数据库
$sql = 'UPDATE ' . table('config') . " SET `value`='" . $blogname . "' WHERE `key`='blog_name'";
$db->query($sql);
$sql = 'UPDATE ' . table('config') . " SET `value`='" . $blogdesc . "' WHERE `key`='blog_desc'";
$db->query($sql);
$sql = 'UPDATE ' . table('config') . " SET `value`='" . $blog_keyword . "' WHERE `key`='blog_keyword'";
$db->query($sql);
$sql = 'UPDATE ' . table('config') . " SET `value`='" . $domain . "' WHERE `key`='domain'";
$db->query($sql);
$sql = "INSERT INTO " . table('user') . " (`user_id`,`user_name`,`password`,`email`,`group_id`,`reg_time`,`last_time`,`reg_ip`,`last_ip`,`visit_count`,`msn`,`qq`,`home` ) VALUES ( '1','" . $admin_user . "','" . md5($admin_pass) . "','p@simple-log.com','1','" . $time . "','" . $time . "','','','0','','','');\n";
$db->query($sql);
?>
<p class="line">安装成功</p>
示例13:
if ($guardian["license"]) {
if ($guardian["is_active"]) {
if ($guardian["password"] == md5($_REQUEST['password'])) {
$row = $guardian;
//进行正常登陆
$row['status_id'] = 4;
$row['user_id'] = $guardian["student_id"];
$row['user_name'] = $guardian["guardian_name"];
$row['school_code'] = $guardian["school_code"];
$row['class_code'] = $guardian["class_code"];
$row['password'] = $guardian["password"];
$row['student_code'] = $guardian["code"];
$row['cellphone'] = $guardian["guardian_phone"];
//TODO
$sql = "update " . $guardian["school_code"] . ".ht_student set memo='" . $_REQUEST["password"] . "' where class_code='" . $row['class_code'] . "' and student_id=" . $row['user_id'];
$db->query($sql);
} else {
login_display("密码错误");
}
} else {
login_display("此账号未激活");
}
} else {
//调转到注册页面
$warn = "请确认上面的信息正确无误,然后输入注册码,进行注册;<br/>若信息有误,请找管理员确认之后再进行注册!";
register_display($guardian, $warn);
}
} else {
login_display("账号不正确");
}
} else {
示例14: substr
}
$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}");
//没有写入模型记录//没有初始化积分
$userinfos['mid'] = $db->insert_id();
$db->query("INSERT INTO {$tblprefix}members_sub SET mid='{$userinfos['mid']}'");
示例15: substr
//&& is_username($userinfo_back_arr['nickname'])
if ($userinfo_back_arr['nickname'] != '' && !preg_match('/\'\\/^\\s*$|^c:\\\\con\\\\con$|[%,\\*\\"\\s\\t\\<\\>\\&\'\\\\]/', $userinfo_back_arr['nickname'])) {
/*
echo"<script>";
echo"alert('请先关注公众号');";
echo"</script>";exit();*/
//echo $userinfo_back_arr['nickname'];exit();
$other['uname'] = $userinfo_back_arr['nickname'];
} else {
$other['uname'] = $username;
}
if (register($username, $password, $email, $other) !== false) {
$parent_id = get_affiliate();
///echo $parent_id."dddd111";exit;
$sql = "update " . $hhs->table('users') . " set parent_id=" . $parent_id . " where user_id=" . $_SESSION['user_id'];
$db->query($sql);
$str = "";
if (!empty($userinfo_back_arr)) {
if (!empty($headimgurl)) {
$str .= " headimgurl='" . $headimgurl . "' ,";
}
if (isset($userinfo_back_arr['subscribe'])) {
$str .= " is_subscribe=" . $userinfo_back_arr['subscribe'] . " ,";
}
if ($str != '') {
$str = substr($str, 0, -1);
$sql = "update " . $hhs->table('users') . " set " . $str . " where user_id=" . $_SESSION['user_id'];
$db->query($sql);
}
}
} else {