vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Forum Home Enhancements - Track Guest Visits (https://vborg.vbsupport.ru/showthread.php?t=131314)

rouho1 01-22-2007 03:52 AM

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.

Mudvayne 01-22-2007 05:34 AM

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!

reebosak 01-24-2007 04:25 AM

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

Quote:

Originally Posted by Paul M (Post 1154265)
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).

reebosak 01-24-2007 05:12 AM

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!

Paul M 01-24-2007 07:36 AM

Quote:

Originally Posted by reebosak (Post 1166204)
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.

reebosak 01-24-2007 02:46 PM

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

reebosak 01-24-2007 02:58 PM

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'];
                        }
                }


Paul M 01-24-2007 05:05 PM

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.

Shazz 01-24-2007 07:27 PM

/me updates much thanx

johnrizz 01-26-2007 10:17 PM

Like always Paul, your the man! **installed**


All times are GMT. The time now is 11:07 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
  • Page Generation 0.01746 seconds
  • Memory Usage 1,774KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete