function checkpass1($username, $password, $safecv, $lgt = 0) { global $db, $timestamp, $onlineip, $db_ckpath, $db_ckdomain, $men_uid, $db_ifsafecv, $db_ifpwcache, $db_logintype; $str_logintype = ''; if ($db_logintype) { for ($i = 0; $i < 3; $i++) { ${'logintype_' . $i} = $db_logintype & pow(2, $i) ? 1 : 0; } } else { $logintype_0 = 1; } !${'logintype_' . $lgt} && Showmsg('login_errortype'); switch (intval($lgt)) { case 0: $str_logintype = 'username'; break; case 1: $str_logintype = 'uid'; break; case 2: !preg_match("/^[-a-zA-Z0-9_\\.]+@([0-9A-Za-z][0-9A-Za-z-]+\\.)+[A-Za-z]{2,5}\$/", $username) && Showmsg('illegal_email'); $str_logintype = 'email'; break; default: $str_logintype = 'username'; break; } $men_uid = ''; if (intval($lgt) == 2) { $query = $db->query("SELECT m.uid,m.username,m.password,m.safecv,m.groupid,m.memberid,m.yz,md.onlineip,md.postnum,md.rvrc,md.money,md.credit,md.currency,md.lastpost,md.onlinetime,md.todaypost,md.monthpost,md.monoltime,md.digests " . " FROM pw_members m LEFT JOIN pw_memberdata md ON md.uid=m.uid" . " WHERE m." . $str_logintype . "=" . pwEscape($username) . " LIMIT 2"); $int_querynum = $db->num_rows($query); if (!$int_querynum) { Showmsg('user_not_exists'); } elseif ($int_querynum == 1) { $men = $db->fetch_array($query); } else { Showmsg('reg_email_have_same'); } } else { $men = $db->get_one("SELECT m.uid,m.username,m.password,m.safecv,m.groupid,m.memberid,m.yz,md.onlineip,md.postnum,md.rvrc,md.money,md.credit,md.currency,md.lastpost,md.onlinetime,md.todaypost,md.monthpost" . " FROM pw_members m LEFT JOIN pw_memberdata md ON md.uid=m.uid" . " WHERE m." . $str_logintype . "=" . pwEscape($username)); } if ($men) { $e_login = explode("|", $men['onlineip']); if ($e_login[0] != $onlineip . ' *' || $timestamp - $e_login[1] > 600 || $e_login[2] > 1) { $men_uid = $men['uid']; $men_pwd = $men['password']; $check_pwd = $password; $men['yz'] > 2 && Showmsg('login_jihuo'); if (strlen($men_pwd) == 16) { $check_pwd = substr($password, 8, 16); /*支持 16 位 md5截取密码*/ } if ($men_pwd == $check_pwd && (!$db_ifsafecv || $men['safecv'] == $safecv)) { if (strlen($men_pwd) == 16) { $db->update("UPDATE pw_members SET password="******"WHERE uid=" . pwEscape($men_uid)); } $L_groupid = $men['groupid'] == '-1' ? $men['memberid'] : $men['groupid']; Cookie("ck_info", $db_ckpath . "\t" . $db_ckdomain); } else { global $L_T; $L_T = $timestamp - $e_login[1] > 600 ? 5 : $e_login[2]; $L_T ? $L_T-- : ($L_T = 5); $F_login = "******"; $db->update("UPDATE pw_memberdata SET onlineip=" . pwEscape($F_login) . "WHERE uid=" . pwEscape($men_uid)); Showmsg('login_pwd_error'); } } else { global $L_T; $L_T = 600 - ($timestamp - $e_login[1]); Showmsg('login_forbid'); } } else { global $errorname; $errorname = $username; Showmsg('user_not_exists'); } //Start Here会员排行榜 if ($db_ifpwcache & 1) { require_once R_P . 'lib/elementupdate.class.php'; $elementupdate = new ElementUpdate(); $elementupdate->userSortUpdate($men); } //End Here return array($men_uid, $L_groupid, PwdCode($password)); }
function User_info() { global $db, $timestamp, $db_onlinetime, $winduid, $windpwd, $safecv, $db_ifonlinetime, $c_oltime, $onlineip, $db_ipcheck, $tdtime, $montime, $db_ifsafecv, $db_ifpwcache, $uc_server; PwNewDB(); $detail = getUserByUid($winduid); if (empty($detail) && $uc_server) { require_once R_P . 'require/ucuseradd.php'; } $loginout = 0; if ($db_ipcheck && strpos($detail['onlineip'], $onlineip) === false) { $iparray = explode('.', $onlineip); strpos($detail['onlineip'], $iparray[0] . '.' . $iparray[1]) === false && ($loginout = 1); } if (!$detail || PwdCode($detail['password']) != $windpwd || $db_ifsafecv && $safecv != $detail['safecv'] || $loginout || $detail['yz'] > 1) { $GLOBALS['groupid'] = 'guest'; require_once R_P . 'require/checkpass.php'; Loginout(); if ($detail['yz'] > 1) { $GLOBALS['jihuo_uid'] = $detail['uid']; Showmsg('login_jihuo'); } Showmsg('ip_change'); } else { list($detail['shortcut'], $detail['appshortcut']) = explode("\t", $detail['shortcut']); unset($detail['password']); $detail['honor'] = substrs($detail['honor'], 90); $distime = $timestamp - $detail['lastvisit']; if ($distime > $db_onlinetime || $distime > 3600) { //Start elementupdate if ($db_ifpwcache & 1 && SCR != 'post' && SCR != 'thread') { require_once R_P . 'lib/elementupdate.class.php'; $elementupdate = new ElementUpdate(); $elementupdate->userSortUpdate($detail); } //End elementupdate if (!GetCookie('hideid')) { $ecpvisit = pwEscape($timestamp, false); $ct = 'lastvisit=' . $ecpvisit . ',thisvisit=' . $ecpvisit; if ($db_ifonlinetime) { $c_oltime = $c_oltime <= 0 ? 0 : ($c_oltime > $db_onlinetime * 1.2 ? $db_onlinetime : intval($c_oltime)); $s_oltime = pwEscape($c_oltime, false); $ct .= ',onlinetime=onlinetime+' . $s_oltime; if ($detail['lastvisit'] > $montime) { $ct .= ',monoltime=monoltime+' . $s_oltime; } else { $ct .= ',monoltime=' . $s_oltime; } $c_oltime && updateDatanalyse($winduid, 'memberOnLine', $c_oltime); $c_oltime = 0; } $db->update("UPDATE pw_memberdata SET {$ct} WHERE uid=" . pwEscape($winduid)); $detail['lastvisit'] = $detail['thisvisit'] = $timestamp; } } } return $detail; }
/** * 获取用户信息 */ function User_info() { global $db, $timestamp, $db_onlinetime, $winduid, $windpwd, $bday, $safecv, $db_ifonlinetime, $c_oltime, $onlineip, $db_ipcheck, $tdtime, $montime, $db_ifsafecv, $db_ifpwcache, $uc_server, $db_md_ifopen; PwNewDB(); $detail = getUserByUid($winduid); if (empty($detail) && $uc_server) { require_once R_P . 'require/ucuseradd.php'; } $loginout = 0; if ($db_ipcheck && strpos($detail['onlineip'], $onlineip) === false) { $iparray = explode('.', $onlineip); strpos($detail['onlineip'], $iparray[0] . '.' . $iparray[1]) === false && ($loginout = 1); } if (!$detail || PwdCode($detail['password']) != $windpwd || $db_ifsafecv && $safecv != $detail['safecv'] || $loginout || $detail['yz'] > 1) { $GLOBALS['groupid'] = 'guest'; require_once R_P . 'require/checkpass.php'; Loginout(); if ($detail['yz'] > 1) { $GLOBALS['jihuo_uid'] = $detail['uid']; Showmsg('login_jihuo'); } Showmsg('ip_change'); } else { list($detail['shortcut'], $detail['appshortcut']) = explode("\t", $detail['shortcut']); unset($detail['password']); $detail['honor'] = substrs($detail['honor'], 90); $distime = $timestamp - $detail['lastvisit']; if ($distime > $db_onlinetime || $distime > 3600) { /*--- element update ---start*/ if ($db_ifpwcache & 1 && SCR != 'post' && SCR != 'thread') { L::loadClass('elementupdate', '', false); $elementupdate = new ElementUpdate(); $elementupdate->userSortUpdate($detail); } /*--- element update ---end*/ if (!GetCookie('hideid')) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $updateMemberData = $updateByIncrementMemberData = array(); $updateMemberData['lastvisit'] = $timestamp; $updateMemberData['thisvisit'] = $timestamp; if ($db_ifonlinetime) { $c_oltime = intval($c_oltime); $c_oltime = $c_oltime <= 0 ? 0 : ($c_oltime > $db_onlinetime * 1.2 ? $db_onlinetime : $c_oltime); $updateByIncrementMemberData['onlinetime'] = $c_oltime; if ($detail['lastvisit'] > $montime) { $updateByIncrementMemberData['monoltime'] = $c_oltime; } else { $updateMemberData['monoltime'] = $c_oltime; } if ($c_oltime) { require_once R_P . 'require/functions.php'; updateDatanalyse($winduid, 'memberOnLine', $c_oltime); } $c_oltime = 0; } if (get_date($timestamp, 'Y-m-d') > get_date($detail['lastvisit'], 'Y-m-d')) { /*更新今日登录数*/ $stasticsService = L::loadClass('Statistics', 'datanalyse'); $stasticsService->login($winduid); /*连续登录天数*/ if ($db_md_ifopen) { require_once R_P . 'require/functions.php'; doMedalBehavior($winduid, 'continue_login'); } } $userService->update($winduid, array(), $updateMemberData); $updateByIncrementMemberData && $userService->updateByIncrement($winduid, array(), $updateByIncrementMemberData); $detail['lastvisit'] = $detail['thisvisit'] = $timestamp; } } } return $detail; }