Thread: Forum Home Enhancements - Track Guest Visits
View Single Post
  #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
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01077 seconds
  • Memory Usage 1,781KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete