//更新本地用户库 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(); $experience = $credit = 0; $avatar_exists = ckavatar($space['uid']); if ($avatar_exists) { if (!$space['avatar']) { //奖励积分 $reward = getreward('setavatar', 0); $credit = $reward['credit']; $experience = $reward['experience']; if ($credit) { $setarr['credit'] = "credit=credit+{$credit}"; }
} $space['isfriend'] = 0; if ($_SGLOBAL['supe_uid'] && $space['friends'] && in_array($_SGLOBAL['supe_uid'], $space['friends'])) { $space['isfriend'] = 1; //Is a friend } $jumpurl = $_GET['app'] ? "userapp.php?id={$_GET['app']}&my_extra=invitedby_bi_{$_GET['u']}_{$_GET['c']}&my_suffix=Lw%3D%3D" : "space.php?uid={$space['uid']}"; if ($space['isfriend']) { showmessage('you_have_friends', $jumpurl, 1); } if (submitcheck('invitesubmit')) { if (empty($_SGLOBAL['supe_uid'])) { showmessage('invite_code_error'); } include_once S_ROOT . './source/function_cp.php'; invite_update($invite['id'], $_SGLOBAL['supe_uid'], $_SGLOBAL['supe_username'], $space['uid'], $space['username'], $_GET['app']); showmessage('friends_added', $jumpurl, 1, array($_SN[$space['uid']])); } //Friend List $flist = array(); $query = $_SGLOBAL['db']->query("SELECT fuid AS uid, fusername AS username FROM " . tname('friend') . " WHERE uid='{$invite['uid']}' AND status='1' ORDER BY num DESC, dateline DESC LIMIT 0,12"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { realname_set($value['uid'], $value['username']); $flist[] = $value; } realname_get(); $albumnum = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('album') . " WHERE uid='{$invite['uid']}'"), 0); $doingnum = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('doing') . " WHERE uid='{$invite['uid']}'"), 0); $blognum = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('blog') . " WHERE uid='{$invite['uid']}'"), 0); $threadnum = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('thread') . " WHERE uid='{$invite['uid']}'"), 0); $tagspacenum = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('tagspace') . " WHERE uid='{$invite['uid']}'"), 0);
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']; //判断用户是否设置了头像 $reward = $setarr = array(); $experience = $credit = 0; $avatar_exists = ckavatar($space['uid']); if ($avatar_exists) { if (!$space['avatar']) { //奖励积分 $reward = getreward('setavatar', 0); $credit = $reward['credit']; $experience = $reward['experience']; if ($credit) { $setarr['credit'] = "credit=credit+{$credit}"; } if ($experience) { $setarr['experience'] = "experience=experience+{$experience}"; } $setarr['avatar'] = 'avatar=1'; $setarr['updatetime'] = "updatetime={$_SGLOBAL['timestamp']}"; } } else { if ($space['avatar']) { $setarr['avatar'] = 'avatar=0'; } } //变更记录 if ($_SCONFIG['my_status']) { inserttable('userlog', array('uid' => $newuid, 'action' => 'add', 'dateline' => $_SGLOBAL['timestamp']), 0, true); } // echo var_dump($_SESSION['jumpurl'])."--_SESSION['jumpurl']<br/>"; // breakpoint(); showmessage('login_success', $_SESSION['jumpurl']); }
function DB_Set_Logined($uid) { global $db, $_SGLOBAL, $_SN; // echo var_dump($_SN)."--_SN0<br>"; $setarr = array('uid' => $uid, 'username' => '', 'password' => ''); $query = $db->query("SELECT username,password FROM " . tname('member') . " WHERE uid='{$setarr['uid']}'"); if ($value = $db->fetch_array($query)) { $setarr['username'] = addslashes($value['username']); $setarr['password'] = addslashes($value['password']); } $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>"; include_once S_ROOT . './source/function_space.php'; //开通空间 $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('space') . " WHERE uid='{$setarr['uid']}'"); 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']); //这里$_SN再次被赋值 // echo var_dump($_SN)."--_SN2<br>"; //设置cookie ssetcookie('auth', authcode("{$setarr['password']}\t{$setarr['uid']}", 'ENCODE'), $cookietime); ssetcookie('loginuser', $passport['username'], 31536000); ssetcookie('_refer', ''); //同步登录 include_once S_ROOT . './uc_client/client.php'; $ucsynlogin = uc_user_synlogin($setarr['uid']); // echo var_dump($ucsynlogin)."--ucsynlogin<br>"; //好友邀请 if ($invitearr) { // echo $_SGLOBAL."--_SGLOBAL1<br>"; // echo var_dump($_SN)."--_SN1<br>"; // echo var_dump($invitearr['id'])."--invitearr['id']<br>"; // echo var_dump($setarr['uid'])."--setarr['uid']<br>"; // echo var_dump($setarr['username'])."--setarr['username']<br>"; // echo var_dump($invitearr['uid'])."--invitearr['uid']<br>"; // echo var_dump($invitearr['username'])."--invitearr['username']<br>"; //成为好友 invite_update($invitearr['id'], $setarr['uid'], $setarr['username'], $invitearr['uid'], $invitearr['username'], $app); } // echo var_dump($_SGLOBAL['supe_uid'])."--_SGLOBAL['supe_uid']<br>"; // echo var_dump($space['uid'])."--space['uid']<br>"; //判断用户是否设置了头像 $_SGLOBAL['supe_uid'] = $space['uid']; $reward = $setarr = array(); $experience = $credit = 0; $avatar_exists = ckavatar($space['uid']); if ($avatar_exists) { if (!$space['avatar']) { //奖励积分 $reward = getreward('setavatar', 0); $credit = $reward['credit']; $experience = $reward['experience']; if ($credit) { $setarr['credit'] = "credit=credit+{$credit}"; } if ($experience) { $setarr['experience'] = "experience=experience+{$experience}"; } $setarr['avatar'] = 'avatar=1'; $setarr['updatetime'] = "updatetime={$_SGLOBAL['timestamp']}"; } } else { if ($space['avatar']) { $setarr['avatar'] = 'avatar=0'; } } if (empty($_POST['refer'])) { $_POST['refer'] = 'space.php?do=home'; } realname_get(); showmessage('login_success', $app ? "userapp.php?id={$app}" : $_POST['refer'], 1, array($ucsynlogin)); }
function quickregister_interface($quickcollegeid, $quickpassword) { //先是验证是否已经激活 $collegeid = trim($quickcollegeid); $collegepw = $quickpassword; $verifyname = verifycollegeid($collegeid, $collegepw); $res_json = array(); if ($verifyname == -1) { $res_json = array('status' => "error", "reason" => 'collegeid_is_null'); } elseif ($verifyname == -2) { $res_json = array('status' => 'error', 'reason' => 'collegepassword_is_null'); } if (empty($verifyname->out->string)) { $res_json = array('status' => 'error', 'reason' => 'verify_fail'); } $username = $collegeid; $password = $collegepw; $query = $_SGLOBAL['db']->query("SELECT identifier,identifier_not_use, realname,birthday, sex, defaultemail, isactive, emaildateline FROM " . tname('baseprofile') . " WHERE collegeid='{$collegeid}' and (usertype like binary '教师' or (usertype between 1 and 5) or usertype like binary '学生') limit 1"); $one = $_SGLOBAL['db']->fetch_array($query); $id = $one['identifier_not_use']; $realname = $one['realname']; $birthday_exist = $one['birthday']; if (strlen($id) == 18) { $birthday_id = substr($id, 6, 8); } elseif (strlen($id) == 16) { $birthday_id = '19' . substr($id, 6, 6); } if ($one) { $wheresql = "0"; if ($id) { $wheresql .= " or identifier_not_use='" . $id . "'"; } if (strlen($birthday_exist) == 8) { $wheresql .= " or (realname='" . $realname . "' and birthday='" . $birthday_exist . "')"; } if ($birthday_id) { $wheresql .= " or (realname='" . $realname . "' and birthday='" . $birthday_id . "')"; } $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('baseprofile') . " WHERE {$wheresql}"); $flagnotactive = 0; $flagactive = 0; $userlines = $recordids = array(); $c_uid = 0; while ($row = $_SGLOBAL['db']->fetch_array($query)) { $userlines[] = $row; if ($row['isactive'] == '1') { $flagactive = 1; } else { $flagnotactive = 1; $recordids[] = $row['userid']; } if ($row['uid']) { if (!$c_uid) { $c_uid = $row['uid']; } elseif ($c_uid != $row['uid']) { $act_err = 1; } } } //如果一个人激活了多个ihome账号时,系统将向ihome邮箱发送检查邮件 if ($act_err) { $title = cplang('active_different_uids_title'); $content = $collegeid . " " . $realname . " " . cplang('active_different_uids_content'); $cid = inserttable('mailcron', array('email' => '*****@*****.**'), 1); $setarr = array('cid' => $cid, 'subject' => addslashes(stripslashes($title)), 'message' => addslashes(stripslashes($content)), 'dateline' => $_GLOBAL['timestamp']); inserttable('mailqueue', $setarr); } //如果既有激活的 也有没激活的 更新没激活的信息 if ($flagactive == 1 && $flagnotactive == 1) { $useridlist = implode(',', $recordids); $_SGLOBAL['db']->query("UPDATE " . tname('baseprofile') . " SET isactive=1, uid={$c_uid} WHERE userid in ({$useridlist})"); foreach ($userlines as $value) { if ($value['isactive'] != '1') { if ($value['academy']) { if ($value['usertype'] == '教师' || $value['usertype'] == 5 || $value['usertype'] == 4) { $workinfo = array('uid' => $c_uid, 'type' => 'work', 'title' => '北京航空航天大学', 'subtitle' => $value['academy'], 'startyear' => $value['startyear'], 'city' => '北京'); inserttable('spaceinfo', $workinfo, 1); } if (strlen($value['collegeid']) != 5 && strlen($value['collegeid']) != 6) { if (!in_array($value['collegeid'], $collegeids)) { $collegeids[] = $value['collegeid']; $eduinfo = array('uid' => $c_uid, 'type' => 'edu', 'title' => '北京航空航天大学', 'subtitle' => $value['academy'], 'startyear' => $value['startyear']); inserttable('spaceinfo', $eduinfo, 1); } } } } } $res_json = array("status" => "error", "indentifier is active"); } elseif ($flagactive == 1) { $res_json = array("status" => "error", "indentifier is active"); } } else { $res_json = array('status' => "error", "reason" => "Please use correct register method!"); } if ($_SCONFIG['seccode_register']) { include_once S_ROOT . '../source/function_cp.php'; if (!ckseccode($_POST['quickseccode'])) { $res_json = array("status" => "error", "reason" => 'incorrect_code'); } } if (!@(include_once S_ROOT . '../uc_client/client.php')) { $res_json = array("status" => "error", "reason" => 'system_error'); } $email = isemail(trim($_POST['quickemail'])) ? trim($_POST['quickemail']) : ''; if (empty($email)) { $res_json = array('status' => 'error', 'reason' => 'email_format_is_wrong'); } if ($count = getcount('space', array('username' => $username))) { $res_json = array('status' => 'error', 'reason' => 'user_name_already_exists'); } if ($count = getcount('spacefield', array('email' => $email))) { $res_json = array('status' => 'error', 'reason' => 'email_has_been_registered'); } $onlineip = getonlineip(); if ($_SCONFIG['regipdate']) { $query = $_SGLOBAL['db']->query("SELECT dateline FROM " . tname('space') . " WHERE regip='{$onlineip}' ORDER BY dateline DESC LIMIT 1"); if ($value = $_SGLOBAL['db']->fetch_array($query)) { if ($_SGLOBAL['timestamp'] - $value['dateline'] < $_SCONFIG['regipdate'] * 3600) { $res_json = array('status' => 'regip_has_been_registered'); } } } //验证完成 //创建新用户.开始 $newuid = uc_user_register($username, $password, $email); if ($newuid <= 0) { if ($newuid == -1) { $res_json = array('status' => 'error', 'reason' => 'user_name_is_not_legitimate'); } elseif ($newuid == -2) { $res_json = array('status' => 'error', 'reason' => 'include_not_registered_words'); } elseif ($newuid == -3) { $res_json = array('status' => 'error', 'reason' => 'user_name_already_exists'); } elseif ($newuid == -4) { $res_json = array('status' => 'error', 'reason' => 'email_format_is_wrong'); } elseif ($newuid == -5) { $res_json = array('status' => 'error', 'reason' => 'email_not_registered'); } elseif ($newuid == -6) { $res_json = array('status' => 'error', 'reason' => 'email_has_been_registered'); } else { $res_json = array('status' => 'error', 'reason' => 'register_error'); } } else { //检查uid是否在ucenter里面,如果不在,就采取野蛮方式插入新纪录 $q = $_SGLOBAL['db']->query("SELECT uid FROM ihomeuser_members WHERE uid='{$newuid}'"); $members_match = $_SGLOBAL['db']->fetch_array($q); $members_match = $members_match['uid']; $q = $_SGLOBAL['db']->query("SELECT uid FROM ihomeuser_memberfields WHERE uid='{$newuid}'"); $memberfields_match = $_SGLOBAL['db']->fetch_array($q); $memberfields_match = $memberfields_match['uid']; if (!$members_match && !$memberfields_match) { $salt = substr(uniqid(rand()), -6); $hhpassword = md5(md5($password) . $salt); $sqladd = "uid='" . intval($newuid) . "',"; $sqladd .= " secques='',"; $_SGLOBAL['db']->query("INSERT INTO ihomeuser_members SET {$sqladd} username='******', password='******', email='{$email}', regip='" . $_SERVER["HTTP_X_FORWARDED_FOR"] . "', regdate='" . time() . "', salt='{$salt}'"); $_SGLOBAL['db']->query("INSERT INTO ihomeuser_memberfields SET uid='{$newuid}'"); } $setarr = array('uid' => $newuid, 'username' => $username, 'password' => md5($password)); inserttable('member', $setarr, 0, true); //add action log inserttable('actionlog', array('uid' => "{$newuid}", 'dateline' => "{$_SGLOBAL['timestamp']}", 'action' => 'register', 'value' => 'quick')); include_once S_ROOT . './source/function_space.php'; $space = space_open($newuid, $username, 0, $email); //默认好友 $flog = $inserts = $fuids = $pokes = array(); if (!empty($_SCONFIG['defaultfusername'])) { $query = $_SGLOBAL['db']->query("SELECT uid,username FROM " . tname('space') . " WHERE\tusername 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']}')"; $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); } } } //好友邀请 if ($invitearr) { include_once S_ROOT . '../source/function_cp.php'; invite_update($invitearr['id'], $setarr['uid'], $setarr['username'], $invitearr['uid'], $invitearr['username'], $app); //如果提交的邮箱地址与邀请相符的则直接通过邮箱验证 if ($invitearr['email'] == $email) { updatetable('spacefield', array('emailcheck' => 1), array('uid' => $newuid)); } //统计更新 include_once S_ROOT . '../source/function_cp.php'; if ($app) { updatestat('appinvite'); } else { updatestat('invite'); } } //标记为已激活,并反写uid if ($recordids) { $useridlist = implode(',', $recordids); $_SGLOBAL['db']->query("UPDATE " . tname('baseprofile') . " SET isactive=1, uid={$newuid} WHERE userid in ({$useridlist})"); } $insertinfo = array('identifier' => $one['identifier'], 'realname' => $realname, 'defaultemail' => $one['defaultemail']); //获得用户生日数据 //$decid = M_decode($value['identifier'], aeskeyA); $UserBirthday = ''; if ($birthday_id) { $UserBirthday = $birthday_id; } elseif ($birthday_exist) { $UserBirthday = $birthday_exist; } if ($UserBirthday) { $insertinfo['birthyear'] = intval(substr($UserBirthday, 0, 4)); $insertinfo['birthmonth'] = intval(substr($UserBirthday, 4, 2)); $insertinfo['birthday'] = intval(substr($UserBirthday, 6, 2)); } if ($one['sex'] == '男') { $sexc = 1; } else { if ($one['sex'] == '女') { $sexc = 2; } else { $sexc = 0; } } $insertinfo['sex'] = $sexc; //print_r($insertinfo);exit(); //更新spacefield updatetable('spacefield', $insertinfo, array('uid' => $newuid)); if ($insertinfo['birthyear'] && $insertinfo['birthmonth'] && $insertinfo['birthday']) { $_SGLOBAL['db']->query("INSERT INTO " . tname('spaceinfo') . " (type,subtype,uid,friend) VALUES ('base','birth'," . $newuid . ",3)"); } //更新space $space = array('uid' => $newuid, 'name' => $realname, 'namestatus' => 1); //print_r($space); //exit(); updatetable('space', $space, array('uid' => $newuid)); foreach ($userlines as $value) { if ($value['isactive'] != '1') { if ($value['academy']) { if ($value['usertype'] == '教师' || $value['usertype'] == 5 || $value['usertype'] == 4) { $workinfo = array('uid' => $newuid, 'type' => 'work', 'title' => '北京航空航天大学', 'subtitle' => $value['academy'], 'startyear' => $value['startyear'], 'city' => '北京'); inserttable('spaceinfo', $workinfo, 1); } if (strlen($value['collegeid']) != 5 && strlen($value['collegeid']) != 6) { if (!empty($value['class']) && !empty($value['startyear'])) { $eduinfo = array('uid' => $newuid, 'type' => 'edu', 'title' => '北京航空航天大学', 'subtitle' => $value['academy'] . $value['startyear'] . '级' . $value['class'] . '班', 'startyear' => $value['startyear']); $tagname = $value['startyear'] . '年' . $value['class'] . '班'; auto_join($newuid, $tagname, $_SGLOBAL['db']); inserttable('spaceinfo', $eduinfo, 1); } } } } } //毕业校友的就业信息 $query1 = $_SGLOBAL['db']->query("SELECT * FROM " . tname('stuemp') . " WHERE collegeid='{$value['collegeid']}'"); if ($value1 = $_SGLOBAL['db']->fetch_array($query1)) { $setarr1 = array('uid' => $newuid, 'type' => 'work', 'title' => $value['unit'], 'province' => $value['province'], 'city' => $value['city']); inserttable('spaceinfo', $setarr1, 1); } //变更记录 if ($_SCONFIG['my_status']) { inserttable('userlog', array('uid' => $newuid, 'action' => 'add', 'dateline' => $_SGLOBAL['timestamp']), 0, true); } //创建新用户结束 $res_json = array('status' => 'correct', 'uid' => $newuid, 'username' => $username, 'password' => $password, 'email' => $email); } //自动为用户添加好友 if ($userlines) { autobefriends($userlines, $newuid, $_POST['username']); } echo json_encode($res_json); return json_encode($res_json); }