<?php //引入语言包 $u_langpackage = new userslp(); //变量获得 $user_id = get_sess_userid(); $ol_is_latent = intval(get_argg('is_hidden')); echo $ol_is_latent; //表声明区 $t_users = $tablePreStr . "users"; $t_online = $tablePreStr . "online"; $dbo = new dbex(); //读写分离定义函数 dbtarget('w', $dbServs); //更新online表 $sql = "update {$t_online} set `hidden`={$ol_is_latent} where user_id={$user_id};"; if ($dbo->exeUpdate($sql)) { set_sess_online($ol_is_latent); echo $u_langpackage->u_set_suc; } else { echo $u_langpackage->u_set_los; }
$sql = "delete from {$t_invite_code} where code_txt='{$invite_code}'"; $dbo->exeUpdate($sql); } //写入数据 $user_ico = $user_sex == 0 ? "skin/{$skinUrl}/images/d_ico_0_small.gif" : "skin/{$skinUrl}/images/d_ico_1_small.gif"; dbtarget('w', $dbServs); $sql = "insert into {$t_users} (user_name,user_pws,user_sex,user_email,user_add_time,user_ico,invite_from_uid,is_pass,lastlogin_datetime,birth_year , birth_month , birth_day ,login_ip )" . " values('{$user_name}','{$user_pws}',{$user_sex},'{$user_email}',NOW(),'{$user_ico}',{$invite_fromuid},{$is_pass},NOW(),'','','','{$_SERVER['REMOTE_ADDR']}')"; if (!$dbo->exeUpdate($sql)) { action_return(0, $re_langpackage->re_reg_false, "-1"); } $user_id = mysql_insert_id(); set_sess_userid($user_id); set_sess_usersex($user_sex); set_sess_username($user_name); set_sess_userico($user_ico); set_sess_online('0'); $now_time = time(); $sql = "insert into {$t_online} (user_id,user_name,user_sex,user_ico,active_time,hidden) values ({$user_id},'{$user_name}',{$user_sex},'{$user_ico}','{$now_time}',0)"; $dbo->exeUpdate($sql); foreach ($sort_rs as $rs) { $sort_id = $rs['id']; $sort_name = $rs['name']; $sql = "insert into {$t_pals_sort} ( name , user_id ) values ( '{$sort_name}' , {$user_id} )"; $dbo->exeUpdate($sql); } if ($invite_fromuid) { increase_integral($dbo, $int_invited, $invite_fromuid); //取得介绍人的资料信息 $user_row = api_proxy("user_self_by_uid", "user_id,user_name,user_sex,user_ico,palsreq_limit", $invite_fromuid); if ($user_row) { $touser_id = $user_row['user_id'];
echo 'emailmsg|' . $l_langpackage->l_lock_u; exit; } $mypals = getMypals($dbo, $user_info['user_id'], $t_mypals); set_sess_mypals($mypals); set_sess_username($user_info['user_name']); set_sess_userid($user_info['user_id']); set_sess_usersex($user_info['user_sex']); set_sess_cgroup($user_info['creat_group']); set_sess_jgroup($user_info['join_group']); set_sess_userico($user_info['user_ico']); set_session('hidden_pals', $user_info['hidden_pals_id']); set_session('hidden_type', $user_info['hidden_type_id']); set_sess_plugins($user_info['use_plugins']); set_sess_apps($user_info['use_apps']); set_sess_online($hidden); set_session($user_info['user_id'] . "_dressup", $user_info['dressup']); $sql = "select * from {$t_frontgroup} where gid='{$user_info['user_group']}'"; $rights = $dbo->getRow($sql); if ($rights) { set_sess_rights($rights['rights']); } else { set_sess_rights(""); } //定义写操作 dbtarget('w', $dbServs); $now_time = time(); $last_data = date("Y-m-d", strtotime($user_info['lastlogin_datetime'])); $now_data = date("Y-m-d", $now_time); if ($last_data != $now_data) { increase_integral($dbo, $int_login, $user_info['user_id']);
function paper_related_save_user_session($user_openid) { global $tablePreStr; global $dbServs; global $log; $t_users = $tablePreStr . "users"; $dbo = new dbex(); dbtarget('r', $dbServs); $querySql = "select user_id,user_nickname,user_ico,position_x,position_y,user_school from {$t_users} where weixin_openid = '{$user_openid}'"; $res = $dbo->getRow($querySql); file_put_contents($log, "\nSave User " . $user_openid . " Session Sql Query: " . $querySql . " Query Res: " . (empty($res) ? "NULL" : "Not NULL"), FILE_APPEND); if (!empty($res)) { set_sess_userid($res['user_id']); set_sess_weixin_openid($user_openid); set_sess_username($res['user_nickname']); set_sess_userico($res['user_ico']); set_session('position_x', $res["position_x"]); set_session('position_y', $res["position_y"]); set_session('user_school', $res['user_school']); set_sess_online('0'); file_put_contents($log, "\n Save User Name: " . $res['user_nickname'], FILE_APPEND); } }