function xwb_setSiteUserLogin($uid) { global $_G; if (empty($uid)) { return false; } //登录 $member = DB::fetch_first("SELECT * FROM " . DB::table('common_member') . " WHERE uid='" . $uid . "'"); if (!$member) { return false; } setloginstatus($member, time() + 60 * 60 * 24 ? 2592000 : 0); DB::query("UPDATE " . DB::table('common_member_status') . " SET lastip='" . $_G['clientip'] . "', lastvisit='" . time() . "' WHERE uid='{$uid}'"); include_once libfile('function/stat'); updatestat('login'); updatecreditbyaction('daylogin', $uid); checkusergroup($uid); return true; }
function setloginstatus($member, $cookietime) { global $_G; $_G['uid'] = intval($member['uid']); $_G['username'] = $member['username']; $_G['adminid'] = $member['adminid']; $_G['groupid'] = $member['groupid']; $_G['formhash'] = formhash(); $_G['session']['invisible'] = getuserprofile('invisible'); $_G['member'] = $member; loadcache('usergroup_' . $_G['groupid']); C::app()->session->isnew = true; C::app()->session->updatesession(); dsetcookie('auth', authcode("{$member['password']}\t{$member['uid']}", 'ENCODE'), $cookietime, 1, true); dsetcookie('loginuser'); dsetcookie('activationauth'); dsetcookie('pmnum'); include_once libfile('function/stat'); updatestat('login', 1); if (defined('IN_MOBILE')) { updatestat('mobilelogin', 1); } if ($_G['setting']['connect']['allow'] && $_G['member']['conisbind']) { updatestat('connectlogin', 1); } $rule = updatecreditbyaction('daylogin', $_G['uid']); if (!$rule['updatecredit']) { checkusergroup($_G['uid']); } }
function pick_reg($info) { $member = $info; extract($info); global $_G; loaducenter(); require_once libfile('function/misc'); require_once libfile('function/profile'); include_once libfile('class/member'); $activation = array(); if (!$activation) { $usernamelen = dstrlen($username); if ($usernamelen < 3) { return milu_lang('too_short'); } elseif ($usernamelen > 15) { return milu_lang('too_long'); } $username = addslashes(trim(dstripslashes($username))); $email = trim($email); } if (!$activation) { $uid = uc_user_register($username, $password, $email, $questionid, $answer, $_G['clientip']); if ($uid <= 0) { if ($uid == -1) { return milu_lang('bad_word'); } elseif ($uid == -2) { return milu_lang('system_bad_word'); } elseif ($uid == -3) { return milu_lang('reged'); } elseif ($uid == -4) { return milu_lang('wrong_email'); } elseif ($uid == -5) { return milu_lang('bad_email'); } elseif ($uid == -6) { return milu_lang('email_reged'); } else { return milu_lang('unknow_error'); } } } else { list($uid, $username, $email) = $activation; } if (DB::result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE uid='{$uid}'")) { if (!$activation) { uc_user_delete($uid); } return milu_lang('uid_reged'); } $init_arr = explode(',', $_G['setting']['initcredits']); $groupinfo['groupid'] = $_G['setting']['newusergroupid']; $password = md5(random(10)); $secques = $questionid > 0 ? random(8) : ''; //用户资料 $profile['constellation'] = get_constellation($birthmonth, $birthday); $profile['zodiac'] = get_zodiac($birthyear); $profile['gender'] = $gender == milu_lang('baomi') ? 0 : ($gender == milu_lang('man') ? 1 : 0); $profile_field_arr = array('birthyear', 'birthmonth', 'birthday', 'birthprovince', 'birthcity', 'birthdist', 'birthcommunity', 'resideprovince', 'residecity', 'residedist', 'residecommunity', 'residesuite', 'site', 'bio', 'interest', 'idcardtype', 'idcard', 'bloodtype', 'height', 'weight', 'qq', 'msn', 'taobao', 'yahoo', 'icq', 'alipay', 'lookingfor', 'position', 'occupation', 'education', 'company', 'graduateschool', 'revenue', 'telephone', 'mobile', 'constellation', 'realname', 'zodiac', 'affectivestatus'); foreach ($profile_field_arr as $k => $v) { $profile[$v] = ${$v}; } $lastactivity = rand($regdate, $regdate + 3600 * 24 * 2); if ($regipsql) { DB::query($regipsql); } $credits = 0; if (!empty($_G['setting']['creditsformula'])) { eval("\$credits = round(" . $_G['setting']['creditsformula'] . ");"); } $userdata = array('uid' => $uid, 'username' => $username, 'password' => $password, 'email' => $email, 'adminid' => 0, 'groupid' => $groupinfo['groupid'], 'regdate' => $regdate, 'credits' => $credits, 'timeoffset' => 9999); $status_data = array('uid' => $uid, 'regip' => $regip, 'lastip' => $lastip, 'lastvisit' => $lastvisit, 'lastactivity' => $lastactivity, 'lastpost' => $lastpost, 'lastsendmail' => 0); $profile['uid'] = $uid; $field_forum['uid'] = $uid; $field_forum['sightml'] = $sightmlm; $field_home['uid'] = $uid; DB::insert('common_member', paddslashes($userdata)); DB::insert('common_member_status', paddslashes($status_data)); DB::insert('common_member_profile', paddslashes($profile)); DB::insert('common_member_field_forum', paddslashes($field_forum)); DB::insert('common_member_field_home', paddslashes($field_home)); if ($verifyarr) { $setverify = array('uid' => $uid, 'username' => $username, 'verifytype' => '0', 'field' => daddslashes(serialize($verifyarr)), 'dateline' => $lastactivity); DB::insert('common_member_verify_info', $setverify); DB::insert('common_member_verify', array('uid' => $uid)); } $count_data = array('uid' => $uid, 'oltime' => $oltime ? $oltime : 0, 'extcredits1' => $extcredits1 ? $extcredits1 : $init_arr[1], 'extcredits2' => $extcredits2 ? $extcredits2 : $init_arr[2], 'extcredits3' => $extcredits3 ? $extcredits3 : $init_arr[3], 'extcredits4' => $extcredits4 ? $extcredits4 : $init_arr[4], 'extcredits5' => $extcredits5 ? $extcredits5 : $init_arr[5], 'extcredits6' => $extcredits6 ? $extcredits6 : $init_arr[6], 'extcredits7' => $extcredits7 ? $extcredits7 : $init_arr[7], 'extcredits8' => $extcredits8 ? $extcredits8 : $init_arr[8]); DB::insert('common_member_count', paddslashes($count_data)); DB::insert('common_setting', array('skey' => 'lastmember', 'svalue' => $username), false, true); manyoulog('user', $uid, 'add'); $totalmembers = DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_member')); $userstats = array('totalmembers' => $totalmembers, 'newsetuser' => $username); checkusergroup($uid); //更新用户所在的用户组 save_syscache('userstats', $userstats); $re_arr['uid'] = $uid; return $re_arr; }
*/ if (!defined('IN_DISCUZ')) { exit('Access Denied'); } if ($_G['inajax'] && $_GET['showcredit']) { include template('common/extcredits'); exit; } $perpage = 20; $page = empty($_GET['page']) ? 1 : intval($_GET['page']); if ($page < 1) { $page = 1; } $start = ($page - 1) * $perpage; ckstart($start, $perpage); checkusergroup(); $operation = in_array($_GET['op'], array('base', 'buy', 'transfer', 'exchange', 'log', 'rule')) ? trim($_GET['op']) : 'base'; $opactives = array($operation => ' class="a"'); if (in_array($operation, array('base', 'buy', 'transfer', 'exchange', 'rule'))) { $operation = 'base'; } include_once libfile('spacecp/credit_' . $operation, 'include'); function makecreditlog($log, $otherinfo = array()) { global $_G; $log['dateline'] = dgmdate($log['dateline'], 'Y-m-d H:i'); $log['optype'] = lang('spacecp', 'logs_credit_update_' . $log['operation']); $log['opinfo'] = ''; $info = $url = ''; switch ($log['operation']) { case 'TRC':
function connect_login($connect_member) { global $_G; $member = DB::fetch_first("SELECT * FROM " . DB::table('common_member') . " WHERE uid='{$connect_member['uid']}'"); if (!$member) { return false; } require_once libfile('function/member'); $cookietime = 1296000; setloginstatus($member, $cookietime); dsetcookie('connect_login', 1, $cookietime); dsetcookie('connect_is_bind', '1', 31536000); dsetcookie('connect_uin', $connect_member['conopenid'], 31536000); include_once libfile('function/stat'); updatestat('login', 1); updatestat('connectlogin', 1); updatecreditbyaction('daylogin', $_G['uid']); checkusergroup($_G['uid']); return true; }
function on_login() { global $_G; if ($_G['uid']) { $ucsynlogin = $_G['setting']['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : ''; $param = array('username' => $_G['member']['username'], 'uid' => $_G['member']['uid']); showmessage('login_succeed', dreferer(), $param, array('showdialog' => 1, 'locationtime' => true, 'extrajs' => $ucsynlogin)); } $seccodecheck = $_G['setting']['seccodestatus'] & 2; $invite = getinvite(); if (!submitcheck('loginsubmit', 1, $seccodecheck)) { $_G['referer'] = dreferer(); $thetimenow = '(GMT ' . ($_G['setting']['timeoffset'] > 0 ? '+' : '') . $_G['setting']['timeoffset'] . ') ' . dgmdate(TIMESTAMP, 'u') . ($cookietimecheck = !empty($_G['cookie']['cookietime']) ? 'checked="checked"' : ''); if ($seccodecheck) { $seccode = random(6, 1) + $seccode[0] * 1000000; } $username = !empty($_G['cookie']['loginuser']) ? htmlspecialchars($_G['cookie']['loginuser']) : ''; $navtitle = lang('core', 'title_login'); include template('member/login'); } else { if (!($_G['member_loginperm'] = logincheck())) { showmessage('login_strike'); } if ($_G['gp_fastloginfield']) { $_G['gp_loginfield'] = $_G['gp_fastloginfield']; } $_G['uid'] = $_G['member']['uid'] = 0; $_G['username'] = $_G['member']['username'] = $_G['member']['password'] = ''; $result = userlogin($_G['gp_username'], $_G['gp_password'], $_G['gp_questionid'], $_G['gp_answer'], $_G['setting']['autoidselect'] ? 'auto' : $_G['gp_loginfield']); if ($result['status'] > 0) { setloginstatus($result['member'], $_G['gp_cookietime'] ? 2592000 : 0); DB::query("UPDATE " . DB::table('common_member_status') . " SET lastip='" . $_G['clientip'] . "', lastvisit='" . time() . "', lastactivity='" . TIMESTAMP . "' WHERE uid='{$_G['uid']}'"); $ucsynlogin = $_G['setting']['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : ''; include_once libfile('function/stat'); updatestat('login', 1); updatecreditbyaction('daylogin', $_G['uid']); checkusergroup($_G['uid']); if ($invite['id']) { DB::update("common_invite", array('fuid' => $uid, 'fusername' => $username), array('id' => $invite['id'])); updatestat('invite'); } if ($invite['uid']) { require_once libfile('function/friend'); friend_make($invite['uid'], $invite['username'], false); dsetcookie('invite_auth', ''); if ($invite['appid']) { updatestat('appinvite'); } } if (!empty($_G['inajax']) && empty($_G['gp_quickforward'])) { $_G['setting']['msgforward'] = unserialize($_G['setting']['msgforward']); $mrefreshtime = intval($_G['setting']['msgforward']['refreshtime']) * 1000; loadcache('usergroups'); $usergroups = addslashes($_G['cache']['usergroups'][$_G['groupid']]['grouptitle']); $message = 1; include template('member/login'); } else { $param = array('username' => $_G['member']['username'], 'uid' => $_G['member']['uid'], 'syn' => $ucsynlogin ? 1 : 0); if ($_G['groupid'] == 8) { showmessage('login_succeed_inactive_member', 'home.php?mod=space&do=home', $param, array('extrajs' => $ucsynlogin)); } else { showmessage('login_succeed', $invite ? 'home.php?mod=space&do=home' : dreferer(), $param, array('extrajs' => $ucsynlogin)); } } } elseif ($result['status'] == -1) { $auth = authcode($result['ucresult']['username'] . "\t" . FORMHASH, 'ENCODE'); $location = 'member.php?mod=' . $_G['setting']['regname'] . '&action=activation&auth=' . rawurlencode($auth); if ($_G['inajax'] && empty($_G['gp_quickforward'])) { $message = 2; include template('member/login'); } else { showmessage('login_activation', $location); } } else { $password = preg_replace("/^(.{" . round(strlen($_G['gp_password']) / 4) . "})(.+?)(.{" . round(strlen($_G['gp_password']) / 6) . "})\$/s", "\\1***\\3", $_G['gp_password']); $errorlog = dhtmlspecialchars(TIMESTAMP . "\t" . ($result['ucresult']['username'] ? $result['ucresult']['username'] : dstripslashes($_G['gp_username'])) . "\t" . $password . "\t" . "Ques #" . intval($_G['gp_questionid']) . "\t" . $_G['clientip']); writelog('illegallog', $errorlog); loginfailed($_G['member_loginperm']); $fmsg = $result['ucresult']['uid'] == '-3' ? empty($_G['gp_questionid']) || $answer == '' ? 'login_question_empty' : 'login_question_invalid' : 'login_invalid'; showmessage($fmsg, '', array('loginperm' => $_G['member_loginperm'])); } } }