When a user log out of my site, it appears their handle stay in the "Online Now" section of the User Info block much, much too long. Is there any way I can make so when my users log out, then they disappear from the Online Now field?
Joined: Aug 29, 2004 Posts: 7458 Location: Arizona
Posted:
Tue Apr 22, 2008 6:51 am
oyjord, sorry for the delay. I want to <bump> this thread for you to try and get you an answer. Unfortunately, I must leave the boards until tomorrow...
Joined: Aug 29, 2004 Posts: 7458 Location: Arizona
Posted:
Fri May 16, 2008 6:07 am
oyjord, I am not certain about this, but you might try messing around with the following code in mainfile.php:
=== FIND CODE ===
Code:
function online() {
global $nsnst_const, $user, $cookie, $prefix, $db;
if(!file_exists('includes/nukesentinel.php')) {
$ip = $_SERVER['REMOTE_ADDR'];
} else {
$ip = $nsnst_const['remote_ip'];
}
$guest = 0;
if (is_user($user)) {
cookiedecode($user);
$uname = $cookie[1];
if (!isset($uname)) {
$uname = $ip;
$guest = 1;
}
} else {
$uname = $ip;
$guest = 1;
}
$past = time()-3600;
$sql = 'DELETE FROM '.$prefix.'_session WHERE time < \''.$past.'\'';
$db->sql_query($sql);
$sql = 'SELECT time FROM '.$prefix.'_session WHERE uname=\''.$uname.'\'';
$result = $db->sql_query($sql);
$ctime = time();
if (!empty($uname)) {
$uname = substr($uname, 0,25);
$row = $db->sql_fetchrow($result);
if ($row) {
$db->sql_query('UPDATE '.$prefix.'_session SET uname=\''.$uname.'\', time=\''.$ctime.'\', host_addr=\''.$ip.'\', guest=\''.$guest.'\' WHERE uname=\''.$uname.'\'');
} else {
$db->sql_query('INSERT INTO '.$prefix.'_session (uname, time, host_addr, guest) VALUES (\''.$uname.'\', \''.$ctime.'\', \''.$ip.'\', \''.$guest.'\')');
}
}
}
Take a look especially at this line here:
$past = time()-3600;
I believe changing that 3600, which is 60 minutes.
Sorry, though, don't know what other ramifications this could have as I've never tried changing it and don't have time to search through the code for where else this is used.
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum