function online_gc() { global $time, $conf; $expiry = $time - $conf['online_hold_time']; $n = db_exec("DELETE FROM `bbs_online` WHERE last_date<'{$expiry}'"); // 重新统计在线数, MyISAM count 快,InnoDB 慢。 runtime_set('onlines', max(1, online_count())); // 清理缓存 online_list_cache_delete(); }
$user['token'] = user_token_set($uid, $gid, $user['password'], $user['avatar'], $user['username'], 'bbs'); // 更新在线 online_list_cache_delete(); online_unset('create_email'); online_unset('create_verifycode'); message(0, $user); } // 退出 } elseif ($action == 'logout') { $user = user_guest(); user_token_clean(); $uid = 0; $gid = 0; // 更新在线 online_save(TRUE); online_list_cache_delete(); message(0, jump('退出成功', './', 1)); // 获取当前用户的信息 } elseif ($action == 'read') { $user = user_read($uid); $agreelist = myagree_find_by_uid($uid); empty($user) and $user = user_guest(); user_ajax_info($user); message(0, $user); // 用户发表的喜欢 } elseif ($action == 'agree') { $_uid = param(2, 0); $_user = user_read($_uid); $page = param(3, 1); $pagesize = 10; //$conf['pagesize'];