本文整理汇总了PHP中insertsession函数的典型用法代码示例。如果您正苦于以下问题:PHP insertsession函数的具体用法?PHP insertsession怎么用?PHP insertsession使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了insertsession函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: space_open
if (!($space = $_SGLOBAL['db']->fetch_array($query))) {
$space = space_open($setarr['uid'], $setarr['username'], 0, $passport['email']);
}
$_SGLOBAL['member'] = $space;
//实名
realname_set($space['uid'], $space['username'], $space['name'], $space['namestatus']);
//检索当前用户
$query = $_SGLOBAL['db']->query("SELECT password FROM " . tname('member') . " WHERE uid='{$setarr['uid']}'");
if ($value = $_SGLOBAL['db']->fetch_array($query)) {
$setarr['password'] = addslashes($value['password']);
} else {
//更新本地用户库
inserttable('member', $setarr, 0, true);
}
//清理在线session
insertsession($setarr);
//同步登录
if ($_SCONFIG['uc_status']) {
include_once S_ROOT . './uc_client/client.php';
$ucsynlogin = uc_user_synlogin($setarr['uid']);
} else {
$ucsynlogin = '';
}
//好友邀请
if ($invitearr) {
//成为好友
invite_update($invitearr['id'], $setarr['uid'], $setarr['username'], $invitearr['uid'], $invitearr['username'], $app);
}
$_SGLOBAL['supe_uid'] = $space['uid'];
//判断用户是否设置了头像
$reward = $setarr = array();
示例2: synlogin
function synlogin($get, $post)
{
global $_SGLOBAL;
if (!API_SYNLOGIN) {
return API_RETURN_FORBIDDEN;
}
//note 同步登录 API 接口
obclean();
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
$cookietime = 31536000;
$uid = intval($get['uid']);
$query = $_SGLOBAL['db']->query("SELECT uid, username, password FROM " . tname('member') . " WHERE uid='{$uid}'");
if ($member = $_SGLOBAL['db']->fetch_array($query)) {
include_once S_ROOT . './source/function_space.php';
$member = saddslashes($member);
$space = insertsession($member);
//设置cookie
ssetcookie('auth', authcode("{$member['password']}\t{$member['uid']}", 'ENCODE'), $cookietime);
}
ssetcookie('loginuser', $get['username'], $cookietime);
}
示例3: regiter_user_to_uchome
function regiter_user_to_uchome()
{
global $_SCONFIG, $_SGLOBAL, $_SN, $openid_identifier, $setarr, $email, $username, $newuid;
// echo var_dump($_SCONFIG)."--_SCONFIG<br/>";
// echo var_dump($_SGLOBAL)."--_SGLOBAL<br/>";
// echo var_dump($setarr)."--setarr<br/>";
$invitearr = $_SESSION['invitearr'];
//从会话里将已有帐户登录时的邀请信息取出,不用从通行证返回信息里取
$url_plus = $_SESSION['url_plus'];
//从会话里将已有帐户登录时的邀请信息取出,不用从通行证返回信息里取
$app = $_SESSION['app'];
//从会话里将已有帐户登录时的邀请信息取出,不用从通行证返回信息里取
$_SN = $_SESSION['SN'];
//从会话里取出后边要用的这个变量
// echo var_dump($invitearr)."--invitearr<br>";
// echo var_dump($url_plus)."--url_plus<br>";
// echo var_dump($app)."--app<br>";
// echo var_dump($_SN)."--_SN1<br>";
// echo var_dump($_SESSION['jumpurl'])."--_SESSION['jumpurl']<br/>";
//开通空间
// echo var_dump($_SGLOBAL['db'])."--_SGLOBAL['db']<br/>";
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('space') . " WHERE uid='{$setarr['uid']}'");
// echo var_dump($query)."--query<br/>";
include S_ROOT . './source/function_space.php';
if (!($space = $_SGLOBAL['db']->fetch_array($query))) {
$space = space_open($setarr['uid'], $setarr['username'], 0, $email);
}
// echo var_dump($space)."--space<br/>";
// breakpoint();
$_SGLOBAL['member'] = $space;
// echo var_dump($_SGLOBAL['member'])."--_SGLOBAL['member']<br/>";
//实名
realname_set($space['uid'], $space['username'], $space['name'], $space['namestatus']);
//这里$_SN再次被赋值
// echo var_dump($_SN)."--_SNn2<br>";
//检索当前用户
$query = $_SGLOBAL['db']->query("SELECT password FROM " . tname('member') . " WHERE uid='{$setarr['uid']}'");
if ($value = $_SGLOBAL['db']->fetch_array($query)) {
$setarr['password'] = addslashes($value['password']);
} else {
//更新本地用户库
inserttable('member', $setarr, 0, true);
}
// 关联uid和openid
//$db->query("INSERT INTO {$tablepre}user_openids VALUES (null,$newuid,'$openid_identifier')");//openid自带的db链接
$openids = array('uid' => $setarr['uid'], 'url' => $openid_identifier);
inserttable('user_openids', $openids, 0, true);
//uchome的db链接
// showmessage($openidlang['msg_bind_ok'],$plugin_url);//绑定成功
//默认好友
$flog = $inserts = $fuids = $pokes = array();
echo var_dump($_SCONFIG['defaultfusername']) . "--_SCONFIG['defaultfusername']<br/>";
if (!empty($_SCONFIG['defaultfusername'])) {
$query = $_SGLOBAL['db']->query("SELECT uid,username FROM " . tname('space') . " WHERE username IN (" . simplode(explode(',', $_SCONFIG['defaultfusername'])) . ")");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$value = saddslashes($value);
$fuids[] = $value['uid'];
$inserts[] = "('{$newuid}','{$value['uid']}','{$value['username']}','1','{$_SGLOBAL['timestamp']}')";
//$inserts[] = "('$value[uid]','$newuid','$username','1','$_SGLOBAL[timestamp]')";
$inserts[] = "('{$value['uid']}','{$newuid}','{$setarr['username']}','1','{$_SGLOBAL['timestamp']}')";
$pokes[] = "('{$newuid}','{$value['uid']}','{$value['username']}','" . addslashes($_SCONFIG['defaultpoke']) . "','{$_SGLOBAL['timestamp']}')";
//添加好友变更记录
$flog[] = "('{$value['uid']}','{$newuid}','add','{$_SGLOBAL['timestamp']}')";
}
/////////
if ($inserts) {
$_SGLOBAL['db']->query("REPLACE INTO " . tname('friend') . " (uid,fuid,fusername,status,dateline) VALUES " . implode(',', $inserts));
$_SGLOBAL['db']->query("REPLACE INTO " . tname('poke') . " (uid,fromuid,fromusername,note,dateline) VALUES " . implode(',', $pokes));
$_SGLOBAL['db']->query("REPLACE INTO " . tname('friendlog') . " (uid,fuid,action,dateline) VALUES " . implode(',', $flog));
//添加到附加表
$friendstr = empty($fuids) ? '' : implode(',', $fuids);
updatetable('space', array('friendnum' => count($fuids), 'pokenum' => count($pokes)), array('uid' => $newuid));
updatetable('spacefield', array('friend' => $friendstr, 'feedfriend' => $friendstr), array('uid' => $newuid));
//更新默认用户好友缓存
include_once S_ROOT . './source/function_cp.php';
foreach ($fuids as $fuid) {
friend_cache($fuid);
}
}
}
//清理在线session
insertsession($setarr);
//设置cookie
ssetcookie('auth', authcode("{$setarr['password']}\t{$setarr['uid']}", 'ENCODE'), 2592000);
ssetcookie('loginuser', $username, 31536000);
ssetcookie('_refer', '');
// echo var_dump($invitearr)."--invitearr<br/>";
//好友邀请
if ($invitearr) {
//成为好友
invite_update($invitearr['id'], $setarr['uid'], $setarr['username'], $invitearr['uid'], $invitearr['username'], $app);
//统计更新
include_once S_ROOT . './source/function_cp.php';
if ($app) {
updatestat('appinvite');
} else {
updatestat('invite');
}
}
$_SGLOBAL['supe_uid'] = $space['uid'];
//.........这里部分代码省略.........
示例4: checkauth
function checkauth()
{
global $_SGLOBAL, $_SC, $_SCONFIG, $_SCOOKIE, $_SN;
if ($_SGLOBAL['mobile'] && $_GET['m_auth']) {
$_SCOOKIE['auth'] = $_GET['m_auth'];
}
if ($_SCOOKIE['auth']) {
@(list($password, $uid) = explode("\t", authcode($_SCOOKIE['auth'], 'DECODE')));
$_SGLOBAL['supe_uid'] = intval($uid);
if ($password && $_SGLOBAL['supe_uid']) {
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('session') . " WHERE uid='{$_SGLOBAL['supe_uid']}'");
if ($member = $_SGLOBAL['db']->fetch_array($query)) {
if ($member['password'] == $password) {
$_SGLOBAL['supe_username'] = addslashes($member['username']);
$_SGLOBAL['session'] = $member;
} else {
$_SGLOBAL['supe_uid'] = 0;
}
} else {
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('member') . " WHERE uid='{$_SGLOBAL['supe_uid']}'");
if ($member = $_SGLOBAL['db']->fetch_array($query)) {
if ($member['password'] == $password) {
$_SGLOBAL['supe_username'] = addslashes($member['username']);
$session = array('uid' => $_SGLOBAL['supe_uid'], 'username' => $_SGLOBAL['supe_username'], 'password' => $password);
include_once S_ROOT . './source/function_space.php';
insertsession($session);
//登录
} else {
$_SGLOBAL['supe_uid'] = 0;
}
} else {
$_SGLOBAL['supe_uid'] = 0;
}
}
}
}
if (empty($_SGLOBAL['supe_uid'])) {
clearcookie();
} else {
$_SGLOBAL['username'] = $member['username'];
}
}
示例5: checkauth
function checkauth()
{
global $_SGLOBAL, $_SC, $_SCONFIG, $_SCOOKIE, $_SN;
if ($_COOKIE['auth']) {
@(list($password, $uid) = explode(" ", authcode($_COOKIE['auth'], 'DECODE')));
$_SGLOBAL['supe_uid'] = intval($uid);
if ($password && $_SGLOBAL['supe_uid']) {
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname("open_session") . " WHERE uid=" . $_SGLOBAL['supe_uid']);
if ($session = $_SGLOBAL['db']->fetch_array($query)) {
if ($session['password'] == $password) {
$_SGLOBAL['supe_username'] = addslashes($session['username']);
insertsession($session);
//更新session
} else {
$_SGLOBAL['supe_uid'] = 0;
}
} else {
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname("open_member") . " WHERE uid=" . $_SGLOBAL['supe_uid']);
if ($member = $_SGLOBAL['db']->fetch_array($query)) {
if ($member['password'] == $password) {
$_SGLOBAL['supe_username'] = addslashes($member['username']);
$session = array('uid' => $_SGLOBAL['supe_uid'], 'username' => $_SGLOBAL['supe_username'], 'password' => $password);
insertsession($session);
//登录
} else {
$_SGLOBAL['supe_uid'] = 0;
}
} else {
$_SGLOBAL['supe_uid'] = 0;
}
}
}
}
if (empty($_SGLOBAL['supe_uid'])) {
clearcookie();
}
return $_SGLOBAL['supe_uid'];
}