Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard

Reply
 
Thread Tools
Track Guest Visits Details »»
Track Guest Visits
Version: 1.22, by Paul M Paul M is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Category: Forum Home Enhancements - Version: 3.6.x Rating:
Released: 11-11-2006 Last Update: 10-04-2007 Installs: 1249
DB Changes Uses Plugins Auto-Templates
Additional Files Translations  
No support by the author.

This modification is no longer available or supported.

Something that has been repeatedly asked in the "Members who visited today" modifications (all versions) is a similar way to track the number of guests that have visited a forum each day. This isn't possible in stock vbulletin as no record is kept of guest visits, they are a 'realtime' display only. I've therefore finally got round to looking at the issue and produced this modification.

This will add (another) section to the "What's Going On" area. The data is kept in a new table so it should be possible for other uses to be made of it (or display it in other ways). A screenshot of the current display is attached.

Options / Features ;

* The ability to turn it on/off.
* The ability to turn just the display on/off.
* The ability to allow (or prevent) certain usergroups viewing the display.
* The ability to run the display code on all pages (not just forumhome).
* The ability to switch between 'Today' and Rolling 24 Hours display (default).
* The list of guests can be set to be always collapsed on initial view.

* The script that the Guest is running is logged (e.g. showthread, usercp etc).
* The request variables in use are logged (e.g. threadid, userid etc).
* The guest table can be cleaned of old records to help control it's size.
* Controls for the displays automatic template update.
* The datastore read (for spider detection) will read from the File/APC/Memcache/Xcache datastore [if used].

Version 1.19+

* Guest Views data collection - tracking each guests viewing of the forum index page, forums and threads.
* Guest Views data collection can be separately disabled.
* Multiple guest visits to the same page are logged separately.
* Clicking on a Guest type in the main display will list all recent visits by guests of that type.
* Clicking on the option in the guest listing will show that guests viewing data (if enabled).
* Usergroup permissions are now done with the standard vbulleten usergroup permissions system.

Four new usergroup permissions are provided in the usergroup manager.

* Can View the Guests Visited Display - Members can view the guests visited display on Forumhome.
* Can View Guest IP Addresses - Members can see the ip addresses of visiting guests.
* Can View Guest Visits List - Members can view the list of guest visits page.
* Can View Guest Tracking Data - Members can view the individual guest visit tracking page.


Version 1.22+

The option to keep a record of [and display] the most ever guests has been added - this used to be provided by a seperate add-on product.


* All (non usergroup) modification settings are in vBulletin Options > Guest Tracking.

To install ;
  • Unzip the XML files.
  • Upload the bitfields file to your ../includes/xml folder.
  • Import the product into vB using the ACP Product Manager.
  • Set your required permissions in the usergroup manager.
Note that by default no permissions are given, you must set them.

You can get an improved Spiders Definition file, that recognises many more spiders, from this post.

Note: For Spider detection to work you must set Enable Spider Display to 'Yes' in vBulletin Options > Who's Online Options.

A German translation has been provided by hurik in post #769 - (for Version 1.22).


History:

v1.00 : Internal dev version.
v1.01 : Initial vb 3.6 beta release.
v1.02 : Phrasing added, final beta version.
v1.03 : Initial full version, some new options added.
v1.04 : Fix potential variable name clash with WVT Mod.
v1.05 : More options added, script and request variable logging added.
v1.06 : Minor internal code changes, phrasing altered slightly.
v1.07 : Datastore call changed to standard fetch function.
v1.08 : Moved Datastore call due to oddities, and fixed small bug.
v1.09 : Simplified always collapsed code.
v1.10 : Datastore call moved and reverted back to db_fetch.
v1.11 : Added Spider Cache Refresh on install (limited release).
v1.12 : Unique Guest id changed from standard vb id to internally created id.
v1.13 : Changed the SQL to force MySQL to use the index on forumhome.
v1.14 : Changed install code to delete old spider cache before rebuilding it.
v1.15 : Added check to try and detect a broken spider cache and fix it.
v1.16 : Number formatting added to individual totals in display list.
v1.17 : New usergroup display options added, datastore read updated.
v1.18 : Beta for new display options - listing guests and tracking guest views.
v1.19 : First release with the new permissions and display options.
v1.20 : Minor changes to install code only.
v1.21 : Internal development version, not released.
v1.22 : Added the "Most ever guests" option.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #392  
Old 01-22-2007, 03:52 AM
rouho1 rouho1 is offline
 
Join Date: Dec 2006
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi, I have installed this hack but since I am a newbie I have this stupid question on how to access the guests track! On onine.php page nothing has been added.
Reply With Quote
  #393  
Old 01-22-2007, 05:34 AM
Mudvayne's Avatar
Mudvayne Mudvayne is offline
 
Join Date: Dec 2005
Location: /dev/null/
Posts: 393
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1. Admin CP > Whois Online > Enable Spider Display
2. Admin CP > Guest Tracker > Config Who Can View This Block
3. Check Forum Home
4. Smile!
Reply With Quote
  #394  
Old 01-24-2007, 04:25 AM
reebosak reebosak is offline
 
Join Date: Oct 2005
Location: Mountain View, CA
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

edit: wow, i've only had 5 posts on these forums so far? i guess i should post more

Quote:
Originally Posted by Paul M View Post
I have also made some minor changes to the spider detection code to try and solve the "Cannot use string offset as an array" problem that some people are experiencing. However, since I cannot replicate this error these are 'blind' changes, and I cannot say if they will work. If they don't then you can run this with spider detection disabled.
Hey Paul, i installed this mod tonight and had the "Cannot use string offset as an array" error pop up. After some debugging i found that the $vbulletin->wol_spiders is a serialized array, but the plugin code is using it as if it is unserialized. i've made some modifications to your code to unserialize() the data before accessing it and since then it's been running like a charm, afaict.

here's the modified code:
Code:
<plugin active="1" executionorder="5">
			<title>Guest Tracking (4)</title>
			<hookname>global_start</hookname>
			<phpcode><![CDATA[$process = false;
if ($vbulletin->userinfo['userid'] == 0 AND $vbulletin->options['trg'])
{
	$scripts = explode(',',$vbulletin->options['trgscript']);
	if (empty($scripts))
	{
		$process = true;
	}
	else if (!in_array(THIS_SCRIPT, $scripts))
	{
		$process = true;
	}
}

if ($process)
{
	$time = TIMENOW;
	$host= SESSION_HOST;
	$script = THIS_SCRIPT;
	$requests = $_REQUEST;
	$guest = md5(USER_AGENT.IPADDRESS.COOKIE_SALT);
	$useragent = $vbulletin->db->escape_string(USER_AGENT);
	$excludes = explode(',',$vbulletin->options['trgrequests']);
	if (!empty($excludes))
	{
		foreach ($excludes AS $exclude)
		{
			unset ($requests[$exclude]);
		}
	}
	$spidername = '';
	$requests = $vbulletin->db->escape_string(serialize($requests));
	if ($vbulletin->options['trgspiders'] AND $vbulletin->options['enablespiders'])
	{
		unset($agent, $vbulletin->wol_spiders, $ip);
    	$vbulletin->datastore->do_db_fetch("'wol_spiders'");
		if (preg_match('#(' . $vbulletin->wol_spiders['spiderstring'] . ')#si', USER_AGENT, $agent))
		{
			$agent = strtolower($agent[1]);

            $unserialized_spiders = unserialize($vbulletin->wol_spiders);
            $u_agent = $unserialized_spiders['agents'][$agent];
            
			if (false && !empty($u_agent['lookup']))
			{
				$ourip = ip2long($host);
				foreach ($u_agent['lookup'] AS $key => $ip)
				{
					if ($ip['startip'] AND $ip['endip'])
					{
						if ($ourip >= $ip['startip'] AND $ourip <= $ip['endip'])
						{
							$spidername = $u_agent['name'];
						}
					}
					else if ($ip['startip'] == $ourip)
					{
						$spidername = $u_agent['name'];
					}
				}
			}
			else
			{
				$spidername = $u_agent['name'];
			}
		}
	}
	$db->query_write("
		REPLACE INTO ".TABLE_PREFIX."guest
		(guestid, hostip, useragent, lastactive, spider, script, rdata)
		VALUES
		('$guest', '$host', '$useragent', $time, '$spidername', '$script', '$requests')
	");
}]]></phpcode>
		</plugin>
In case anybody is interested, i'm running:
vBulletin : v3.6.4
Guest Tracking : my modified version of 1.14
psiStats 2006 : 1.4.3
Spider Watcher : 1.0.0 Beta 9
Members who have visited the forum : 4.41

i've also attached my modified xml file

Edit: removed file. While I appreciate the effort, it would be a support nightmare for different versions called 1.14 to be in circulation, and the problem is a little more complicated than you think - please see my post below (Paul).
Reply With Quote
  #395  
Old 01-24-2007, 05:12 AM
reebosak reebosak is offline
 
Join Date: Oct 2005
Location: Mountain View, CA
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

upon further inspection, it appears that the "Total guests" section is not displaying crawlers, it just says "Visitors (xx)", but if i view my current users list, i see about 10 crawlers displayed there.this could be something with the settings, or maybe something left to be fixed, or un-broken (if i broke something along the way) i'll try and take a look at the code again tomorrow, for now though, sleep!
Reply With Quote
  #396  
Old 01-24-2007, 07:36 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by reebosak View Post
After some debugging i found that the $vbulletin->wol_spiders is a serialized array, but the plugin code is using it as if it is unserialized. i've made some modifications to your code to unserialize() the data before accessing it and since then it's been running like a charm
Actually, the datastore fetch should unserialize it automatically - the problem is a bit more complicated - as follows ;

In vb 3.6 a new column was added to the datastore table, telling vb if the data should be automatically unserialised when loaded = a value of 0 = no, 1 = yes, 2 = detect (it tries to work it out from the contents). The entry for "wol_spiders" should be 1 - and when you install this mod, it will delete the existing entry and rebuild it with the correct value.

Now the problem is that the new 'unserialize' value is taken from the build_datastore() function (as an added third parameter) but they have defaulted it to 0 if it's not supplied. Code written for vb3.5 does not supply a third parameter (as it didn't exist) so what happens is some old code somewhere runs, and rebuilds the wol_spiders entry with an unserialze value of 0 (due to the missing parameter) - and because of this, subsequent datastore fetches do not unserialise the data, and everything breaks. (This happens a lot to the 'maxloggedin' datastore entry as well - which is why a lot of people who have upgraded to 3.6 have problems with their WOL data resetting to 1 and 1970).

I posted/requested a change to fix this here, but it got zero response.

I hope you understood all that - I think the solution for me will be to add a bit of code to detect if the data was unserialised correctly, and if not, do it myself and rebuild the datastore entry correctly.
Reply With Quote
  #397  
Old 01-24-2007, 02:46 PM
reebosak reebosak is offline
 
Join Date: Oct 2005
Location: Mountain View, CA
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ah, that makes sense. around the time of my last vB update my "most users ever" date was reset to unix start time.

i'll try to grep through my installed plugins tonight to try and find out the culprit that is resetting the datastore
Reply With Quote
  #398  
Old 01-24-2007, 02:58 PM
reebosak reebosak is offline
 
Join Date: Oct 2005
Location: Mountain View, CA
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this won't solve the big picture problem, but adding a quick check to unserialize if needed may be a good work around specific to this plugin to make it work universally. i just added a ternary check to my previously modified code:

Code:
if (preg_match('#(' . $vbulletin->wol_spiders['spiderstring'] . ')#si', USER_AGENT, $agent))
		{
			$agent = strtolower($agent[1]);
			if(is_string($vbulletin->wol_spiders)){
			$wol_spiders = is_string($vbulletin->wol_spiders)?
				unserialize($vbulletin->wol_spiders)
				:$vbulletin->wol_spiders;
            $u_agent = $wol_spiders['agents'][$agent];
            
			if (false && !empty($u_agent['lookup']))
			{
				$ourip = ip2long($host);
				foreach ($u_agent['lookup'] AS $key => $ip)
				{
					if ($ip['startip'] AND $ip['endip'])
					{
						if ($ourip >= $ip['startip'] AND $ourip <= $ip['endip'])
						{
							$spidername = $u_agent['name'];
						}
					}
					else if ($ip['startip'] == $ourip)
					{
						$spidername = $u_agent['name'];
					}
				}
			}
			else
			{
				$spidername = $u_agent['name'];
			}
		}
Reply With Quote
  #399  
Old 01-24-2007, 05:05 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Version 1.15 - as per the above posts, many of the spider issues are due to the spider cache being broken by other modifications - this version will check the loaded data and try to fix the cache if it has been broken in this manner. If it cannot then spider detection will not take place, meaning no errors should occur.

If you are not having any spider detection issues then there is no need to update to this version, there are no other changes.
Reply With Quote
  #400  
Old 01-24-2007, 07:27 PM
Shazz's Avatar
Shazz Shazz is offline
 
Join Date: Jun 2006
Location: Utah
Posts: 4,758
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

/me updates much thanx
Reply With Quote
  #401  
Old 01-26-2007, 10:17 PM
johnrizz's Avatar
johnrizz johnrizz is offline
 
Join Date: Apr 2006
Posts: 333
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Like always Paul, your the man! **installed**
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:41 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06713 seconds
  • Memory Usage 2,325KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete