新闻中心
phpbb论坛首页在线用户列表中隐藏蜘蛛
作者 / 无忧主机 时间 2013-02-07 10:13:30
每个站长都希望蜘蛛可以多来几次自己的网站,蜘蛛来的越多,给网站带来好的排名的机会可能就会越大,但是有时候蜘蛛来到您的phpbb网站的时候,会变成在线用户,其他的用户可以在在线用户列表中看到蜘蛛的影子,这样的情况对您的网站本身没有什么影响,但是可能对用户的体验不够友好,如果您在线浏览帖子的时候看到了蜘蛛机器人,我想您也不会有好心情。下面无忧主机小编就叫大家如何隐藏首页在线列表中的蜘蛛。解决的方法很简单,把在线用户的代码改一改,加一个判读语句,如果判断是蜘蛛就不显示,具体的实现方法如下: 首先通过ftp工具连接您的php虚拟主机找到文件…/includes/functions.php 通过文本编辑器打开并编辑,找到代码:
$user_online_link = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']); $online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link;把上面这段代码替换成:
if ($row['user_type'] <> USER_IGNORE) { $user_online_link = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']); $online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link; } else { $user_online_link = ''; $online_userlist .= ''; }修改好后上传到您的空间中,登陆网站的后台,清空缓存页面,然后您查看在线用户列表的时候,奇迹就会发生了,蜘蛛机器人不会在出现了。
纯Linux环境下高端免备案【香港独立IP地址】php空间,仅仅只需199元一年起。商务中国域名核心代理直销50元注册国际顶级域名
本文地址:https://www.51php.com/phpbb/10668.html






