![]() |
Remove Spiders from Who's Online
*** Staff note: The author of this modification has passed away in a diving accident. We wish his family all strength in dealing with this traggic issue. ***
Remove Spiders from Who's Online The problem The majority of the the "guests" on your forum are probably spiders. While you might think that it is impressive to show so many guests using your forum, this does not reflect the true number of people online. The who's online page does offer visitors the chance to change the display based on members, guests, or spiders, however the totals (and the record number of users online at one time) do not exclude spiders. This mod does not remove spiders from your forum, it simply stops them being counted in the totals. Some search engine spiders such as Yahoo's Slurp can initiate hundreds of connections at the same time (from different IP addresses). Each one of these connections will be included in your totals as a "guest". What does this modification do?
Anyone who wants to their forum to show the true number of users online in the statistics I run a big system, will this slow my board down? Absolutely not. It's been written with big boards in mind. Even if you use a very large spiders_vbulletin.xml file, this file will only be checked once for each new session created. After that, whether the session is used by a spider is recorded in the session table. For users running vBulletin 3.6.6 or later, it will actually increase the speed of the who's online page, since known spiders are no longer compared against the list of known spider user agents. No new database queries are added, as existing queries are used or modified instead. Hasn't this been done before? There are a couple, but I've taken a slightly different approach with this mod - my focus was on simplicity and performance. You might also want to check out some other mods here and here, to see if they suit your purposes better. Installation instructions
Nothing to configure! Just see the note below about spiders_vbulletin.xml How can I make this more effective? Spiders are identified via the includes/xml/spiders_vbulletin.xml file. However, the version that ships with vBulletin is quite small, and will recognise only the most popular spiders. Anything else will still show up in your statistics as a guest, making it hard to tell real guests from spiders. Therefore it is recommended to update your spiders_vbulletin.xml if using this mod. You can obtain a much better version of this file from Christian Stadler here. Please contribute new user agent strings directly to him and encourage him to keep providing new updates of this file. Will using a big spiders_vbulletin.xml slow things down? Theoretically yes, but in practical terms now. Lookups are only one once for each session when it is created. If you are running a version earlier than vBulletin 3.6.6 it will mean that more work must be done on the who's online page, but nowhere else. Which versions of vBulletin will this work on? This mod is designed to work for 3.6.6 and above, but there is some additional code included to handle 3.6.0 - 3.6.5 as well. Optional extras If you are using vBAdvanced then you'll want to modify your online users module. The following change should work for but versions 2.x and 3.x. Go to your modules/onlineusers.php file and locate this line: Code:
WHERE session.lastactivity > " . (TIMENOW - $vbulletin->options['cookietimeout']) . " Code:
" . ($killspiders ? " AND " . TABLE_PREFIX . "session.spider = -1 " : null) . " If you'd like to also include the quick stats in your admincp with this modification open your admincp/index.php file and locate this line: Code:
$guestsarry = $db->query_first("SELECT COUNT(host) AS sessions FROM " . TABLE_PREFIX . "session WHERE userid = 0 AND lastactivity > $datecut"); Code:
$guestsarry = $db->query_first("SELECT COUNT(host) AS sessions FROM " . TABLE_PREFIX . "session WHERE userid = 0 " . (($vbulletin->products['whosonline_kill_spiders'] AND $vbulletin->options['enablespiders']) ? ' AND spider = -1 ' : null) . "AND lastactivity > $datecut"); Code:
DELETE FROM datastore WHERE title = 'maxloggedin' LIMIT 1 Support Will be provided to those who click install Version history 1.0 (15.07.2007) Initial version Disclaimer: No actual spiders where harmed during the development of this modification. |
Reserved
|
Yahoo slurp are the biggest PITB but I just use a robots.txt to reduce the times they are allowed to visit. Works well enough for me. Whats the benefit in this compared to a simple robots.txt ?
Quote:
|
Robots.txt works only for those bots that respect it, and identifying every single bot to put into a robots.txt can also be time consuming. There is also a performance overhead associated with robots.txt. I block all my bad bots directly in the webserver, but all the "good bots" to crawl my site.
However, everything that I've written above (and your question) relating to blocking bots from the site. This mod simply removes the spiders from the totals, allowing you to get a better idea of how many "real" guests you have on your forum. If you keep statistics and graphs as I do this gives you a clearer picture of growth, etc. It also saves questions from users saying "Wow, there were 800 guests online last night, this forum is really popular". |
What can I say??? :rolleyes:
|
Hi Mark! A lovely little hack, when you said you have a bunch o' "why didn't anyone else think of that" hacks, you were right!
I will install sometime soon! And on another note, apologies I have not replied to your email (I'm not ignorant, honest) - I just forgot I'd emailed you from my domain account (and not my Gmail account) - I couldn't work out where your email had gone! |
You know there are some good mods, for example in my forum it seems like this: (14 members & 16 guests & 1 logged out & 32 bots) But I really would like to remove bots from who's online without reducing number in forumhome. Could it be possible?
|
Quote:
|
Some of you might be wondering what is so different about this mod, so I'll take a little bit of time to explain how you might use it to do some different stuff.
This mod actually classifies each session as spider or normal user when the session is created and stores the result in the session table. Why? Because it makes it very easy for us to check the "spider status" on any session from any page, WITHOUT having to compare the user agent against a list of known user agents every time. Why is this better? Two reasons, the first is speed and the second is flexibility. By default the mod will suppress the spiders from the statistics (it won't block anything). But we could use this mod to do more if we wanted. If you look in the session table you'll see an extra column called "spider", the values are -1 (normal user), 0 (not yet determined - you'll rarely see this) and 1 (spider). Now you can easily change things depending on whether a spider is viewing the page or not. You could put something in a template like this: Code:
<if condition="$session[spider] == 1">Come into my parlour, said the spider to the fly</if> Code:
<if condition="$session[spider] == -1">Don't tell the spiders, but they can't see this text.</if> Code:
if ($vbulletin->session->vars['spider'] == 1) So with a little bit of imagination some of you might also be able to see that this mod could help you do all sorts of new things (I've seen many requests for example from people who want to display different links or pages to spiders than normal users - this would be simple using the above techniques). What if you wanted to get some quick statistics to show how many users or guests are online. Easy - now you can use a simple SQL query like this: Code:
SELECT COUNT(*) FROM session WHERE userid = 0 AND spider =-1 Code:
$guests = implode("", $vbulletin->db->query_first("SELECT COUNT(*) FROM session WHERE userid = 0 AND spider =-1 AND lastactivity > " . (TIMENOW - $vbulletin->options['cookietimeout']) . ")) |
thanks
|
I installed this mod and made the corresponding changes to the onlineusers.php file, but when I access my homepage, it says there are some guests on the who's online module block but if I go to the forum who's online display, it says there are no guests. What could be wrong?
|
Quote:
When you first install the mod you will get different values for the numbers of guests in your vbadvanced block, the who's online total, and the total listed on the main forum index. Once your cookie timeout has expired (15-30 minutes) these values should converge to be the same. The reason is that you may be seeing old sessions which (because they are not active) have not been reclassified to either spider or non-spider in the session table. |
Quote:
|
I did the edit for the control panel option and I get an error... It says it can't find the session table.
I had to manually add vb3_ (my prefix) to the session.spider portion of the code you provided and this got rid of the error. I am using 3.6.7 and VBA RC1 |
Quote:
|
There is something wrong in this mod mfyvie, I've installed it 30 minutes ago, but when I click to who's online, I just can see 5 members and 1 guest, but I am pretty sure, there are at least 10 active users for last 2 minutes. I'll wait several minutes too.
|
Hi,
When i use vBadvanced onlineusers.php edit, I get this database error: Quote:
|
Quote:
Quote:
|
Thanks, I may consider installing this, as it might offer an improvement on performance.
|
Great idea. Thanks a bunch!
/me clicks install |
Quote:
Well, I also have "who has wisited today" add-on, it shows the user's last activity time when you hover on nickname. I've counted more than 10 while who's online page shows only 5 members and 1 guest. |
Quote:
Are you saying the display of the members or the guests is incorrect? At first you said it was guests, then you bring up the point about your who has visited today mod which gives you information on members. My mod does nothing at all to the display of members. If you still doubt the mod, best to look into the session table. Which version of vb are you running? It makes a difference because two different sets of code run depending on the version. |
Hi,
Now there is no database error , but despite there is 6 members , i can see in vBadvanced just 1, me. It's working good at forumhome. |
Sorry, I thought I'd changed the example to -1, it was still on 0 (now fixed). In your vbadanced module the line should read spider = -1, not spider = 0. Change that and it should work the way you want it to.
|
Quote:
Now it's working. |
Quote:
Maybe it's because i use too many mods. By the way I'm using classic vbulletin 3.6.7 version. |
Keyness, the only way for you to verify this is to look into the session table. There you will see the guests and how they are classified (by checking the spider column). -1 means a real guest, 0 means not decided, and 1 means a spider.
I have many guests who arrive on my forum by google, but in reality they don't do anything and they don't move around the site. In this case their status may stay on "0" and they won't get shown in the totals. For example, I have a lot of hits where google has brought someone directly to an attachment or an image has been sideloaded because an image in one of my threads has been directly linked in another forum's thread. This type of thing creates sessions in your table, but these users show no activity on your forum in reality. I don't think any other mods are affecting it, because those totals are nothing more than the number of rows returned from the mysql query that checks the spider status of each connection. For example, on my session table right now I have 89 guests with spider status -1 (real guest), 4 with status 0 (unknown) and 81 with status 1 (spider). Of course different forums will vary in how many real guests they have versus spiders. Just bear in mind that a visitor coming in via google could have come in for any reason - it could even be that they found an image via google images and that image was displayed on the google images page - this will appear like a visit, but it isn't really. If you want to be really sure you could do something like a grep on your web server logs for each IP address you want to test. I did this when I was testing the mod, because like you, I thought it might not be working. During this process I actually discovered how many other forums were sideloading my attachments and I reconfigured my web server to block them! |
What software did you use to generate those graphs and how to?
|
The software is called MRTG. It's free, but to be honest it isn't that simple to setup and get running. Once you get it running then you need some extra code to provide the vbulletin specific stuff, I was thinking of releasing that as a mod, but I didn't want to deal with the million requests about how to get MRTG running :(
|
This is the who's online hack I've been waiting for, much simplier and truer than others out there. Like you, I just want to hide the spiders, my users won't care to see what spiders are on the site so no reason to display them IMO, great hack, installing now :)
|
This looks like an EXCELLENT mod!
But honestly, it's more than I want. For example, I don't want to reset my max users online stats and I already have a mod (vbBOL) that shows spiders as spiders in the "who's online" page. Mainly, I am looking for some way of hiding certain html code in my templates from spiders (or showing them custom code), as you show in this example: Code:
<if condition="$session[spider] == 1">Come into my parlour, said the spider to the fly</if> I don't mind not showing spiders as guests in the "Currently Active Users" stats, I just don't want to ruin anything else. I think it would be cool to show how many bots/spiders are online in the "Currently Active Users" stats. As an addition after "__guests" like (42 members, 192 guests and 63 spiders) |
Quote:
This file is also useful for anyone else who doubts that this mod is working, or for anyone who wants to find new spider strings to add to their spiders_vbulletin.xml. Quote:
Quote:
It seems like your only beef with this mod is that it will reset your max online statistics when it installs? The reason it does this is because your max online statistics are probably false! Even if other mods remove the spiders from your display, are they stopping the artificially high number from inflating your max online statistics? Even if they stop it at the front end, have they also thought to stop it in the back end as well? Because as soon as you login to your admincp the wrong statistics will be recorded! My mod stops the admincp from updating this number, even if you haven't done the optional manual edit in the admincp. But if you still want to disable the reset of the maxonline, simply download the .xml file and remove the entire block that looks like this: Code:
<code version="*"> |
One thing I've noticed, I reset the max users online, used to be ridiculously high and inaccurate, immediatly I get a new figure for the time that I did the reset , BUT, it still seems to be including the spiders in this figure as the forum shows 10 members and maybe 10 guests, but most users online after reset shows 100+ ?
|
Quote:
My stats are falsely inflated, but not by more than a couple hundred at most. If I reset it, the figure would be incredibly low and inaccurate, so I don't know which is worse. My boards were WAY more popular 2 years ago than today. The reason I know this (other than the inflated "most users" stat) is we had over 100 new users registering each day. Now we have maybe 30 new users on average per day. "Most users online" currently shows 1,786 (dated 2 years ago) and most of late is around 1,000 less. :( I just noticed I am running 3.6.5 and not 3.6.6. Do you think it will be ok for me to install it? PS. I think it would be cool to show how many bots/spiders are online in the "Currently Active Users" stats. As an addition after "__guests" like (42 members, 192 guests and 63 spiders) |
Quote:
Can you confirm that you aren't running vbadvanced, and that you don't have any other areas of your forum where the maxonline is displayed (or updated)? Also, which version of vb are you running? If you are running pre 3.6.6 there is different code, but I wasn't able to test this because I'm running 3.6.7. Quote:
Quote:
Quote:
|
Very nice mod. Just what I needed. Someone decided it would be fun to spam he online count and I like to report real numbers. Keep up the good work. :)
|
I tried this out on my forum and there seems to be a error on IE 7 users the error # is 163 I think. There is more text and I'll gladly install it again to be verbatim if you need it.
|
Quote:
|
Wow .. a very good mod, installed on my board! :)
|
hey... i love it.... i hate the deceptive countup on my site.... real members and real visitors work better for me to guage what's what!! so thanks..
|
All times are GMT. The time now is 10:25 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|