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
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).