/** * 用户添加关注,同时推送条新鲜事 * * @param $uid 用户 * @param $friendid 关注的对象 * @param $limit 新鲜事数量 */ function addFollow($uid, $friendid, $limit = 20, $from = '') { //fixed global $timestamp; if (!$uid || !$friendid) { return false; } if ($this->isFollow($uid, $friendid)) { return 'user_attention_exists'; } $attentionDB = $this->_getAttentionDB(); $attentionDB->insert(array('uid' => $uid, 'friendid' => $friendid, 'joindate' => $this->_timestamp)); $userServer = L::loadClass('UserService', 'user'); $userServer->updateByIncrement($uid, array(), array('follows' => 1)); $userServer->updateByIncrement($friendid, array(), array('fans' => 1, 'newfans' => 1)); $medalservice = L::loadClass('medalservice', 'medal'); $medalservice->runAutoMedal($friendid, 'fans', 'fans', 1); $friendService = L::loadClass('Friend', 'friend'); if (!$friendService->isFriend($uid, $friendid) || $from == 'addFriend') { $this->addUserWeiboRelationsByFriendid($friendid, $uid, $limit); } /*更新粉丝排行记录*/ L::loadClass('elementupdate', '', false); $elementupdate = new ElementUpdate('fans'); $elementupdate->setCacheNum(100); $elementupdate->totalFansUpdate($friendid); $elementupdate->updateSQL(); $elementupdate->setCacheNum(20); $elementupdate->todayFansUpdate($friendid); $elementupdate->updateSQL(); return true; }
/** * *记录升级排行记录 * */ function elementUpdate($uid) { global $db_ifpwcache; L::loadClass('elementupdate', '', false); $elementupdate = new ElementUpdate('gradeuser'); $elementupdate->ugradeUserUpdate($uid); $elementupdate->updateSQL(); }
} !isset($typeid[$type]) && Showmsg('data_error'); $read = $db->get_one('SELECT subject FROM pw_threads WHERE tid=' . pwEscape($tid)); !$read && Showmsg('data_error'); require_once R_P . 'require/posthost.php'; PostHost("http://push.phpwind.net/push.php?type=collect&url=" . rawurlencode("{$db_bbsurl}/read.php?tid={$tid}") . "&tocharset={$db_charset}&title=" . rawurlencode($read['subject']) . "&bbsname=" . rawurlencode($db_bbsname), ""); $tiddb[$type][] = $tid; $newtids = makefavor($tiddb); $db->update("UPDATE pw_favors SET tids=" . pwEscape($newtids) . ' WHERE uid=' . pwEscape($winddb['uid'])); } else { $db->update("INSERT INTO pw_favors SET " . pwSqlSingle(array('uid' => $winddb['uid'], 'tids' => $tid))); } $db->update("UPDATE pw_threads SET favors=favors+1 WHERE tid=" . pwEscape($tid)); //Start Here pwcache require_once R_P . 'lib/elementupdate.class.php'; $elementupdate = new ElementUpdate(); $elementupdate->newfavorUpdate($tid, $fid); if ($db_ifpwcache & 1024) { $elementupdate->hotfavorUpdate($tid, $fid); } updateDatanalyse($tid, 'threadFav', 1); //End Here Showmsg('job_favor_success'); } elseif ($action == 'tag') { $cachetime = pwFilemtime(D_P . "data/bbscache/tagdb.php"); if (!file_exists(D_P . "data/bbscache/tagdb.php") || $timestamp - $cachetime > 3600) { $tagnum = max($db_tagindex, 200); $tagdb = array(); $query = $db->query("SELECT * FROM pw_tags WHERE ifhot='0' ORDER BY num DESC" . pwLimit($tagnum)); while ($rs = $db->fetch_array($query)) { $tagdb[$rs['tagname']] = $rs['num'];
if ($db_ifpwcache & 32 && $thread['postdate'] > $timestamp - 24 * 3600) { if ($thread['hits'] > $hitsort_judge['hitsortday'][$fid] && $thread['fid'] == $fid) { $updatelist[] = array('hitsortday', $fid, $thread['tid'], $thread['hits'], $thread['postdate'], 0); $updatetype['hitsortday'] = 1; } } if ($db_ifpwcache & 64 && $thread['postdate'] > $timestamp - 7 * 24 * 3600) { if ($thread['hits'] > $hitsort_judge['hitsortweek'][$fid] && $thread['fid'] == $fid) { $updatelist[] = array('hitsortweek', $fid, $thread['tid'], $thread['hits'], $thread['postdate'], 0); $updatetype['hitsortweek'] = 1; } } } if ($updatelist) { L::loadClass('elementupdate', '', false); $elementupdate = new ElementUpdate($fid); $elementupdate->setJudge('hitsort', $hitsort_judge); $elementupdate->setUpdateList($updatelist); $elementupdate->setUpdateType($updatetype); $elementupdate->updateSQL(); unset($elementupdate); } unset($updatelist, $updatetype, $hitsort_judge); } //End Here $pwAnonyHide = $isGM || $pwSystem['anonyhide']; $rewids = $cyids = array(); $arrStatus = array(1 => 'vote', 2 => 'active', 3 => 'reward', 4 => 'trade', 5 => 'debate'); foreach ($tpcdb as $key => $thread) { $foruminfo['allowhtm'] == 1 && ($htmurl = $db_readdir . '/' . $fid . '/' . date('ym', $thread['postdate']) . '/' . $thread['tid'] . '.html'); $thread['tpcurl'] = "read.php?tid={$thread['tid']}" . ($page > 1 ? "&fpage={$page}" : '');
function copyAttachs($tid, $pid, $content, $newtid, $newpid, $newfid) { global $db, $db_ifpwcache; $_aids = $array = array(); $newtid = (int) $newtid; $newpid = (int) $newpid; $newfid = (int) $newfid; $query = $db->query("SELECT * FROM pw_attachs WHERE tid=" . S::sqlEscape($tid) . " AND pid=" . S::sqlEscape($pid)); $count = $ifAttach = 0; while ($rt = $db->fetch_array($query)) { if (!$count && !$pid && $rt['type'] == 'img') { $ifAttach = true; $count++; } if (strpos($content, "[attachment=" . $rt['aid'] . "]") !== false) { $db->update("INSERT INTO pw_attachs\n\t\t\t(fid,uid,tid,pid,did,name,type,size,attachurl,hits,needrvrc,special,ctype,uploadtime,descrip,ifthumb)\n\t\t\tSELECT {$newfid},uid,{$newtid},{$newpid},did,name,type,size,attachurl,hits,needrvrc,special,ctype,uploadtime,descrip,ifthumb\n\t\t\tFROM pw_attachs WHERE aid=" . S::sqlEscape($rt['aid'])); $array[$rt['aid']] = $db->insert_id(); } else { $_aids[] = $rt['aid']; } } if ($_aids) { $db->update("INSERT INTO pw_attachs (fid,uid,tid,pid,did,name,type,size,attachurl,hits,needrvrc,special,ctype,uploadtime,descrip,ifthumb) SELECT {$newfid},uid,{$newtid},{$newpid},did,name,type,size,attachurl,hits,needrvrc,special,ctype,uploadtime,descrip,ifthumb FROM pw_attachs WHERE tid=" . S::sqlEscape($tid) . ' AND pid=' . S::sqlEscape($pid) . ' AND aid IN (' . S::sqlImplode($_aids) . ')'); } //Start elementupdate if ($db_ifpwcache & 512 && $ifAttach) { L::loadClass('elementupdate', '', false); $elementAttach = $db->get_one("SELECT * FROM pw_attachs WHERE tid=" . S::sqlEscape($newtid) . " AND pid=" . S::sqlEscape($pid)); $elementupdate = new ElementUpdate($newfid); $elementupdate->newPicUpdate($elementAttach['aid'], $newfid, $newtid, $elementAttach['attachurl'], $elementAttach['ifthumb'], $content); $elementupdate->updateSQL(); } //End elementupdate return $array; }
function afterReply() { global $db_ifpwcache, $timestamp, $db_readperpage; if ($this->data['ifcheck'] == 1) { if ($this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms'] && $this->tpcArr['replies'] < $db_readperpage) { $StaticPage = L::loadClass('StaticPage'); $StaticPage->update($this->tid); } $lastpost = array('subject' => $this->data['title'] ? substrs($this->data['title'], 26) : 'Re:' . substrs($this->tpcArr['subject'], 26), 'author' => $this->data['lastposter'], 'lastpost' => $timestamp, 'tid' => $this->tid, 't_date' => $this->tpcArr['postdate']); $this->forum->lastinfo('reply', '+', $lastpost); //Start Here pwcache if ($db_ifpwcache & 270) { require_once R_P . 'lib/elementupdate.class.php'; $elementupdate = new ElementUpdate($this->forum->fid); $elementupdate->special = $this->tpcArr['special']; if ($db_ifpwcache & 14) { $elementupdate->replySortUpdate($this->tid, $this->forum->fid, $this->tpcArr['postdate'], $this->tpcArr['replies'] + 1); } if ($db_ifpwcache & 256) { $elementupdate->newReplyUpdate($this->tid, $this->forum->fid, $this->tpcArr['postdate']); } $elementupdate->updateSQL(); } updateDatanalyse($this->data['authorid'], 'memberThread', 1); updateDatanalyse($this->tid, 'threadPost', 1); # memcache refresh $threadsObj = L::loadclass("threads"); $threadsObj->clearThreadByThreadId($this->tid); # memcache refresh $threadlistObj = L::loadclass("threadlist"); $threadlistObj->updateThreadIdsByForumId($this->forum->fid, $this->tid); } if ($this->postdata->filter->filter_weight > 1) { $this->postdata->filter->insert($this->tid, $this->pid, implode(',', $this->postdata->filter->filter_word), $this->postdata->filter->filter_weight); } }
function afterModify() { global $db_ifpwcache; if ($db_ifpwcache & 512 && $this->att && $this->att->elementpic) { $elementpic = $this->att->elementpic; require_once R_P . 'lib/elementupdate.class.php'; $elementupdate = new ElementUpdate($this->forum->fid); $elementupdate->newPicUpdate($elementpic['aid'], $this->forum->fid, $this->tid, $elementpic['attachurl'], '', $this->data['content']); $elementupdate->updateSQL(); } //End elementupdate if ($this->data['ifcheck'] && $this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms']) { $StaticPage = L::loadClass('StaticPage'); $StaticPage->update($this->tid); } if ($this->data['ifcheck'] != $this->atcdb['ifcheck']) { $this->forum->lastinfo('topic', $this->atcdb['ifcheck'] == 1 ? '-' : '+'); } $this->updateForumsextra(); $threads = L::loadClass('Threads'); $threads->delThreads($this->tid); }
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 afterpost() { global $db_ifpwcache, $timestamp; if ($this->data['ifcheck'] == 1) { if ($this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms']) { $StaticPage = L::loadClass('StaticPage'); $StaticPage->update($this->tid); } $lastpost = array('subject' => substrs($this->data['title'], 26), 'author' => $this->data['lastposter'], 'lastpost' => $timestamp, 'tid' => $this->tid, 't_date' => $timestamp); $this->forum->lastinfo('topic', '+', $lastpost); if ($this->forum->isOpen() && !$this->data['anonymous']) { pwAddFeed($this->post->uid, 'post', $this->tid, array('subject' => stripslashes($this->data['title']), 'tid' => $this->tid, 'fid' => $this->forum->fid)); //会员资讯缓存 $usercachedata = array(); $usercache = L::loadDB('Usercache'); $usercachedata['subject'] = substrs(stripWindCode($this->data['title']), 100, N); $usercachedata['content'] = substrs(stripWindCode($this->data['content']), 100, N); $usercachedata['postdate'] = $timestamp; if ($this->att) { $usercachedata['attimages'] = $this->att->getImages(4); } $usercache->update($this->data['authorid'], 'topic', $this->tid, $usercachedata); } //Start elementupdate if ($db_ifpwcache & 128 || $db_ifpwcache & 512 && $this->att && $this->att->elementpic) { require_once R_P . 'lib/elementupdate.class.php'; $elementupdate = new ElementUpdate($this->forum->fid); if ($db_ifpwcache & 128) { $elementupdate->newSubjectUpdate($this->tid, $this->forum->fid, $timestamp, $this->data['special']); } if ($db_ifpwcache & 512 && $this->att && $this->att->elementpic) { $elementupdate->newPicUpdate($this->att->elementpic['aid'], $this->forum->fid, $this->tid, $this->att->elementpic['attachurl'], $this->att->elementpic['ifthumb'], $this->data['content']); } $elementupdate->updateSQL(); } updateDatanalyse($this->data['authorid'], 'memberThread', 1); //End elementupdate } if ($this->postdata->filter->filter_weight > 1) { $this->postdata->filter->insert($this->tid, 0, implode(',', $this->postdata->filter->filter_word), $this->postdata->filter->filter_weight); } if ($this->data['topped'] > 0) { require_once R_P . 'require/updateforum.php'; setForumsTopped($this->tid, $this->data['fid'], $this->data['topped']); updatetop(); } }
function afterModify() { global $db_ifpwcache, $timestamp, $db_kmd_deducttime; if ($db_ifpwcache & 512 && $this->att && $this->att->elementpic) { $elementpic = $this->att->elementpic; L::loadClass('elementupdate', '', false); $elementupdate = new ElementUpdate($this->forum->fid); $elementupdate->newPicUpdate($elementpic['aid'], $this->forum->fid, $this->tid, $elementpic['attachurl'], '', $this->data['content']); $elementupdate->updateSQL(); } //End elementupdate //update at users $threadService = L::loadClass('threads', 'forum'); $threadService->updateAtUsers($this->tid, 0, $this->data['atusers']); if ($this->data['ifcheck'] && $this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms']) { $StaticPage = L::loadClass('StaticPage'); $StaticPage->update($this->tid); } if ($this->data['ifcheck'] != $this->atcdb['ifcheck']) { $actions = $this->atcdb['ifcheck'] == 1 ? '-' : '+'; $this->forum->lastinfo('topic', $actions); if ($this->extraBehavior) { $this->extraBehavior->topicModify($this->tid, $this->data); } } $this->updateForumsextra(); if ($this->data['kmdinfo']) { $kmdService = L::loadClass('KmdService', 'forum'); $tmpTime = $this->data['kmdinfo']['endtime'] - $db_kmd_deducttime * 3600; $newKmdEndTime = $db_kmd_deducttime && $tmpTime > 0 ? $tmpTime : $this->data['kmdinfo']['endtime']; $updateKmdInfo = array('status' => KMD_THREAD_STATUS_CHECK, 'endtime' => $newKmdEndTime); $kmdService->updateKmdInfo($updateKmdInfo, $this->data['kmdinfo']['kid']); } //* $threads = L::loadClass('Threads', 'forum'); //* $threads->delThreads($this->tid); Perf::gatherInfo('changeThreadWithThreadIds', array('tid' => $this->tid)); }
function analyseDataToCache($tpcdb) { global $db_ifpwcache, $timestamp; if (!($db_ifpwcache & 112) || pwFilemtime(D_P . 'data/bbscache/hitsort_judge.php') > $timestamp - 600) { return; } extract(pwCache::getData(D_P . 'data/bbscache/hitsort_judge.php', false)); $updatelist = $updatetype = array(); foreach ($tpcdb as $thread) { if ($db_ifpwcache & 16) { if ($thread['hits'] > $hitsort_judge['hitsort'][$this->fid] && $thread['fid'] == $this->fid) { $updatelist[] = array('hitsort', $this->fid, $thread['tid'], $thread['hits'], '', 0); $updatetype['hitsort'] = 1; } } if ($db_ifpwcache & 32 && $thread['postdate'] > $timestamp - 24 * 3600) { if ($thread['hits'] > $hitsort_judge['hitsortday'][$this->fid] && $thread['fid'] == $this->fid) { $updatelist[] = array('hitsortday', $this->fid, $thread['tid'], $thread['hits'], $thread['postdate'], 0); $updatetype['hitsortday'] = 1; } } if ($db_ifpwcache & 64 && $thread['postdate'] > $timestamp - 7 * 24 * 3600) { if ($thread['hits'] > $hitsort_judge['hitsortweek'][$this->fid] && $thread['fid'] == $this->fid) { $updatelist[] = array('hitsortweek', $this->fid, $thread['tid'], $thread['hits'], $thread['postdate'], 0); $updatetype['hitsortweek'] = 1; } } } if ($updatelist) { L::loadClass('elementupdate', '', false); $elementupdate = new ElementUpdate($this->fid); $elementupdate->setJudge('hitsort', $hitsort_judge); $elementupdate->setUpdateList($updatelist); $elementupdate->setUpdateType($updatetype); $elementupdate->updateSQL(); unset($elementupdate); } }
function afterpost() { global $db_ifpwcache, $timestamp; if ($this->data['ifcheck'] == 1) { if ($this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms']) { $StaticPage = L::loadClass('StaticPage'); $StaticPage->update($this->tid); } $lastpost = array('subject' => substrs($this->data['title'], 26), 'author' => $this->data['lastposter'], 'lastpost' => $timestamp, 'tid' => $this->tid, 't_date' => $timestamp); $this->forum->lastinfo('topic', '+', $lastpost); if ($this->forum->isOpen() && !$this->data['anonymous']) { require_once R_P . 'require/functions.php'; if (!$this->extraBehavior) { $weiboService = L::loadClass('weibo', 'sns'); /* @var $weiboService PW_Weibo */ $weiboContent = substrs(stripWindCode($weiboService->escapeStr(strip_tags($this->data['content']))), 125); $weiboExtra = array('title' => stripslashes($this->data['title']), 'fid' => $this->forum->fid, 'fname' => $this->forum->name, 'atusers' => $this->data['atusers']); $weiboService->send($this->post->uid, $weiboContent, 'article', $this->tid, $weiboExtra); $threadService = L::loadClass('threads', 'forum'); $threadService->setAtUsers($this->tid, 0, $this->data['atusers']); } //会员资讯缓存 $userCache = L::loadClass('Usercache', 'user'); $userCache->delete($this->data['authorid'], array('article', 'cardtopic')); /* $usercachedata = array(); $usercachedata['subject'] = substrs(stripWindCode($this->data['title']), 100, N); $usercachedata['content'] = substrs(stripWindCode($this->data['content']), 100, N); $usercachedata['postdate'] = $timestamp; if ($this->att) { $usercachedata['attimages'] = $this->att->getImages(4); } $userCache->update($this->data['authorid'], 'topic', $this->tid, $usercachedata); */ } //Start elementupdate require_once D_P . 'data/bbscache/o_config.php'; if ($db_ifpwcache & 128 || $o_browseopen || $db_ifpwcache & 512 && $this->att && $this->att->elementpic) { L::loadClass('elementupdate', '', false); $elementupdate = new ElementUpdate($this->forum->fid); if ($db_ifpwcache & 128) { $elementupdate->newSubjectUpdate($this->tid, $this->forum->fid, $timestamp, $this->data['special']); } if ($db_ifpwcache & 512 && $this->att && $this->att->elementpic && $this->_checkIfHidden()) { $elementupdate->newPicUpdate($this->att->elementpic['aid'], $this->forum->fid, $this->tid, $this->att->elementpic['attachurl'], $this->att->elementpic['ifthumb'], $this->data['content']); } if ($o_browseopen) { $elementupdate->setCacheNum(100); /*设置缓存100个*/ $elementupdate->lastPostUpdate($this->data['authorid'], $this->tid, $timestamp); } $elementupdate->updateSQL(); } require_once R_P . 'require/functions.php'; updateDatanalyse($this->data['authorid'], 'memberThread', 1); //End elementupdate } if ($this->postdata->filter->filter_weight > 1) { $this->postdata->filter->insert($this->tid, 0, implode(',', $this->postdata->filter->filter_word), $this->postdata->filter->filter_weight); } if ($this->data['topped'] > 0) { require_once R_P . 'require/updateforum.php'; setForumsTopped($this->tid, $this->data['fid'], $this->data['topped']); updatetop(); } }
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, $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; }