Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 420
0 Users 2 Guests Online
Forum Index » PHP + MySQL » This work is for just a Genius
Posted on Thursday 7th June 2007 at 08:41 PM
gbt91
templates/default/images/noavatar.png's Avatar
Junior Member
Try to make an online users based on time...
plzzzzzzzzzzzzzzzzzzzzzzz
Posted on Thursday 7th June 2007 at 09:15 PM
SkillMaster
templates/default/images/noavatar.png's Avatar
Senior Member
argh.
put this right up the top of config.php under the <?php tag.
Code

include ("online.php");

save this as online.php
Code

<?
include("config.php");
$offline = 2; //seconds
$current = time(); //gets the time on the server (unformatted)
$offline = ($current-$offline);
if ($user[username])
{
$update = mysql_query("UPDATE `members` SET online = '$current' WHERE username = '$logged[username]'");
}
?>

save this as whosonline.php
Code

<?
include "config.php";
$offline = 2; // seconds
$current = time(); //gets the current time
$offline = ($current-$offline); //the cutoff time for being considered online
$getusers = mysql_query("SELECT * from users where online >= '$offline'");
while ($users = mysql_fetch_array($getusers))
{
$username = $users[username];
echo ("$username, ");
}
?>

I don't know what it does but it works. I never looked into it.
Posted on Thursday 7th June 2007 at 10:03 PM
Diablosblizz
templates/default/images/noavatar.png's Avatar
Senior Member
So if they're not active for 2 seconds they get logged off?
Posted on Friday 8th June 2007 at 05:08 AM
SkillMaster
templates/default/images/noavatar.png's Avatar
Senior Member
As I said in a previous topic its not my code, i havent looked into it. i dont know what it does.