MAXdev

How to use MDPro - guest count

jag7720 - Mar 01, 2007 - 05:34 AM
Post subject: guest count
My guest count never seems to go down.

I always seem to have 30-50 guests. I hope this is true but I know it can't be. I require (free) registration to access my site and I can't fathom 30-50 people surfing my site and getting my standard "You must register to access this" message.

Why is the count always high and how can I get the guest count to display accurate info?


Jason
dmcl1 - Mar 01, 2007 - 06:00 AM
Post subject:
Jason,

I believe this has to do with users who have "timed out", but the system did not recognize this and remove them. There are two adjustments I make to the pnSession.php file for my sites based on comments I found when searching the forum.

Open includes/pnSession.php
At approx line 83, change the garbage collection setting, such as
Code:
    // Garbage collection
    ini_set('session.gc_probability', 100);      


And approx line 240, add two new lines of code to delete session variables (I'm including the existing line that they should be placed above for your reference)
Code:
// dmcl1 - next 2 lines added because user is not automatically logged out after timeout
      pnSessionDelVar('rememberme');
      pnSessionDelVar('uid');
        pnSessionNew($sessid, $ipaddr);


If you search the forum for "garbage collection", I think you will run across Pete's comments on this.
jag7720 - Mar 01, 2007 - 06:13 AM
Post subject:
I found line 83 but when I search for pnSessionDelVar I only get a hit on line152

Here is the code around it

Code:

/**
 * Delete a session variable
 *
 * @param name $ name of the session variable to delete
 */
function pnSessionDelVar($name)
{
    $var = "PNSV$name";

    global $$var;
    // Fix for PHP >4.0.6 By John Barnett (johnpb)
    // unset($$var);
    unset($GLOBALS[$var]);

    session_unregister($var);

    return true;




and I only find the rememberme around 467

Code:

            $where = "WHERE $sessioninfocolumn[vars] NOT LIKE '%PNSVrememberme|%'
                      AND $sessioninfocolumn[lastused] < " . (time() - (pnConfigGetVar('secinactivemins') * 60
));
            break;
        case 'Medium':
            // Medium security - delete session info if session cookie has
            // expired or user decided not to remember
            // themself
            $where = "WHERE ($sessioninfocolumn[vars] NOT LIKE '%PNSVrememberme|%'
                      AND $sessioninfocolumn[lastused] < " . (time() - (pnConfigGetVar('secinactivemins') * 60



So where should I add the lines you recommended?


Thanks

Jason
dmcl1 - Mar 01, 2007 - 06:22 AM
Post subject:
pnSessionDelVar() is part of what you are adding. It doesn't exist in the current version. Look for pnSessionNew($sessid, $ipaddr). And put the delvar lines directly above it.
jag7720 - Mar 16, 2007 - 08:26 AM
Post subject:
I added this code and it seemed to make the count go down for a while.... but now it is still hovering around 50

Is there anything else I can do?
All times are GMT + 13 Hours
Powered by MDForum 2.0.8 © 2003-2007 based on phpBB © 2001, 2002 phpBB Team
and by MDRebel which uses Theme Graphics by Daz
and by Attachment-Mod 2.4.3