$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', ''); //好友邀请 if ($invitearr) { include_once S_ROOT . './source/function_cp.php'; invite_update($invitearr['id'], $setarr['uid'], $setarr['username'], $invitearr['uid'], $invitearr['username'], $app); //如果提交的邮箱地址与邀请相符的则直接通过邮箱验证
function friend_update($uid, $username, $fuid, $fusername, $op='add', $gid=0) { global $_SGLOBAL, $_SCONFIG; if(empty($uid) || empty($fuid) || $uid == $fuid) return false; $flog = array( 'uid' => $uid > $fuid ? $uid : $fuid, 'fuid' => $uid > $fuid ? $fuid : $uid, 'dateline' => $_SGLOBAL['timestamp'] ); //好友状态 if($op == 'add' || $op == 'invite') { //自己 inserttable('friend', array('uid'=>$uid, 'fuid'=>$fuid, 'fusername'=>$fusername, 'status'=>1, 'gid'=>$gid, 'dateline'=>$_SGLOBAL['timestamp']), 0, true); //对方更新 if($op == 'invite') { //邀请模式 inserttable('friend', array('uid'=>$fuid, 'fuid'=>$uid, 'fusername'=>$username, 'status'=>1, 'dateline'=>$_SGLOBAL['timestamp']), 0, true); } else { updatetable('friend', array('status'=>1, 'dateline'=>$_SGLOBAL['timestamp']), array('uid'=>$fuid, 'fuid'=>$uid)); } //用户中心添加 if($_SCONFIG['uc_status']) { include_once S_ROOT.'./uc_client/client.php'; uc_friend_add($uid, $fuid); uc_friend_add($fuid, $uid); } $flog['action'] = 'add'; } else { //删除 $_SGLOBAL['db']->query("DELETE FROM ".tname('friend')." WHERE (uid='$uid' AND fuid='$fuid') OR (uid='$fuid' AND fuid='$uid')"); //从用户中心删除 if($_SCONFIG['uc_status']) { include_once S_ROOT.'./uc_client/client.php'; uc_friend_delete($uid, array($fuid)); uc_friend_delete($fuid, array($uid)); } $flog['action'] = 'delete'; } if($_SCONFIG['my_status']) inserttable('friendlog', $flog, 0, true); //缓存 friend_cache($uid); friend_cache($fuid); }
showmessage('do_success', $_POST['refer']); } } elseif ($op == 'groupignore') { $groups = getfriendgroup(); $group = intval($_GET['group']); if (!isset($groups[$group])) { showmessage('change_friend_groupname_error'); } if (submitcheck('groupignoresubmit')) { if (isset($space['privacy']['filter_gid'][$group])) { unset($space['privacy']['filter_gid'][$group]); } else { $space['privacy']['filter_gid'][$group] = $group; } privacy_update(); friend_cache($_SGLOBAL['supe_uid']); //缓存更新 showmessage('do_success', $_POST['refer'], 0); } } elseif ($op == 'blacklist') { if ($_GET['subop'] == 'delete') { $_GET['uid'] = intval($_GET['uid']); $_SGLOBAL['db']->query("DELETE FROM " . tname('blacklist') . " WHERE uid='{$space['uid']}' AND buid='{$_GET['uid']}'"); showmessage('do_success', "space.php?do=friend&view=blacklist&start={$_GET['start']}", 0); } if (submitcheck('blacklistsubmit')) { $_POST['username'] = trim($_POST['username']); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('space') . " WHERE username='******'username']}'"); if (!($tospace = $_SGLOBAL['db']->fetch_array($query))) { showmessage('space_does_not_exist'); }
} $friendfans2 = '我的好友'; $friendlist2 = array(); $friendnumquery2 = $_SGLOBAL['db']->query("SELECT count(x.uid) FROM " . tname('friend') . " x , " . tname('space') . " y WHERE x.uid='{$space['uid']}' AND x.fuid = y.uid AND x.status='1' ORDER BY x.num DESC, x.dateline DESC"); $friendnumarray2 = mysql_fetch_array($friendnumquery2); $friendnum2 = $friendnumarray2['0']; $query = $_SGLOBAL['db']->query("SELECT x.* , y.* FROM " . tname('friend') . " x , " . tname('space') . " y WHERE x.uid='{$space['uid']}' AND x.fuid = y.uid AND y.groupid != 3 AND x.status='1' ORDER BY x.num DESC, x.dateline DESC LIMIT 0,6"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { realname_set($value['fuid'], $value['fusername']); $oluids[$value['fuid']] = $value['fuid']; $friendlist2[] = $value; } if ($friendlist2 && empty($space['friendnum'])) { //자채ᅮᄏᄎᄡ₩ include_once S_ROOT . './source/function_cp.php'; friend_cache($space['uid']); } } /* if($_SGLOBAL['mygroupid']==3||ckprivacy('friend')) { $friendfans = '我的粉丝'; $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('friend')." WHERE uid='$space[uid]' AND status='1' ORDER BY num DESC, dateline DESC LIMIT 0,6"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { realname_set($value['fuid'], $value['fusername']); $oluids[$value['fuid']] = $value['fuid']; $friendlist[] = $value; } if($friendlist && empty($space['friendnum'])) { //자채ᅮᄏᄎᄡ₩ include_once(S_ROOT.'./source/function_cp.php'); friend_cache($space['uid']);
} $space['privacy']['filter_gid'] = array(); if (isset($_POST['privacy']['filter_gid'])) { foreach ($_POST['privacy']['filter_gid'] as $key => $value) { $space['privacy']['filter_gid'][$key] = intval($value); } } $space['privacy']['filter_note'] = array(); if (isset($_POST['privacy']['filter_note'])) { foreach ($_POST['privacy']['filter_note'] as $key => $value) { $space['privacy']['filter_note'][$key] = 1; } } privacy_update(); require_once libfile('function/friend'); friend_cache($_G['uid']); showmessage('do_success', 'home.php?mod=spacecp&ac=privacy&op=' . $operation); } if ($operation == 'filter') { require_once libfile('function/friend'); $groups = friend_group_list(); $filter_icons = empty($space['privacy']['filter_icon']) ? array() : $space['privacy']['filter_icon']; $filter_note = empty($space['privacy']['filter_note']) ? array() : $space['privacy']['filter_note']; $iconnames = $appids = $icons = $uids = $users = array(); foreach ($filter_icons as $key => $value) { list($icon, $uid) = explode('|', $key); $icons[$key] = $icon; $uids[$key] = $uid; if (is_numeric($icon)) { $appids[$key] = $icon; }
function friend_delete($touid) { global $_G; if (!friend_check($touid)) { return false; } DB::delete('home_friend', "(uid='{$_G['uid']}' AND fuid='{$touid}') OR (fuid='{$_G['uid']}' AND uid='{$touid}')"); if (DB::affected_rows()) { addfriendlog($_G['uid'], $touid, 'delete'); friend_cache($_G['uid']); friend_cache($touid); } }
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 friend_delete($touid) { global $_G; if (!friend_check($touid)) { return false; } C::t('home_friend')->delete_by_uid_fuid_dual($_G['uid'], $touid); if (DB::affected_rows()) { addfriendlog($_G['uid'], $touid, 'delete'); friend_cache($_G['uid']); friend_cache($touid); } }
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); }