DO THIS FIRST - - - - - Your Database SQL:CREATE TABLE `onlineuser` ( `timestamp` int(15) NOT NULL DEFAULT '0', `ip` varchar(40) NOT NULL, PRIMARY KEY (`timestamp`), KEY `ip` (`ip`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;_______________________________________________________Edit:template.phpFind: Users Online: <? echo $onlineusers; ?><p>Replace with: Users Online: <? echo $onlineusers; ?><br /><?php $timeoutseconds = 600; // Timeout Value in Seconds - 300 equals 5 minutes. $timestamp=time(); $timeout=$timestamp-$timeoutseconds; $ip = $_SERVER['REMOTE_ADDR']; //Insert all users online $query_add = "INSERT INTO onlineuser VALUES ('$timestamp','$ip')"; $resultt = mysql_query($query_add); if (!$resultt) { echo 'Cannot connect to the database'; } //Delete guest users after timeout - Does not affect members count $query_time = "DELETE FROM onlineuser WHERE timestamp < $timeout"; $resultt = mysql_query($query_time); if (!$resultt) { echo 'Cannot connect to the database'; } //Count all members and guests IP's to make a grand total. //Then subtract the number of members online from the grand total - leaving the Guests. $query_resultt = "SELECT DISTINCT ip FROM onlineuser"; $resultt = mysql_query($query_resultt); if (!$resultt) { echo 'Cannot connect to the database'; } $totalusers = (mysql_num_rows($resultt)); $a="$totalusers"; $b="$onlineusers";?> Guests Online: <?php echo $a - $b; ?><br />
Also i say all of morts mods should be in official releases just saying
But what is the point of the $file_name?
It shouldn't be, as it counts everyone who is online and subtracts the guests, so the actual online count should always be more than guests.In other words 1 member and 1 guest always = 2 - 1 member, and so on.That script was updated in the first post - -