Re: Tracking online users

From: Date: Sat, 10 May 2003 11:23:42 +0000
Subject: Re: Tracking online users
Groups: php.windows 
Request: Send a blank email to php-windows+get-19852@lists.php.net to get a copy of this message
My Idea: Create a Table with two fields Userid or Username and timestamp. And to Something like this in your Mainpage or every other Page you need it in: session_register('dbentry'); $timetolive = 600; // 10 Minutes $timecheck -= time() - $timetolive; mysql_query("DELETE FROM temptable WHERE timestamp<'$timecheck'") if($username&&$userpass&&$dbentry!=true) { mysql_query("INSERT INTO temptable (username, timestamp) VALUES ('$username', '".time()."')"); $dbentry = true; } $usercount = mysql_num_rows(mysql_query("SELECT * FROM temptable")); You'll need Sessions to be enabled for this to work. This is just how i solved it, but i never had a system with more than 50 or so users cheerio, diggn ----- Original Message ----- From: "Guru P Chaturvedi" <bangboy2k2@hotmail.com> To: <php-windows@lists.php.net> Sent: Saturday, May 10, 2003 1:03 PM Subject: Re: [PHP-WIN] Tracking online users > Hi, > > Why i say that db operation is a burdon. Most of the users won't logout > properly thus leavin an entry in the database. Also nearly 10000 users enter > the site so going for a db entry isn't that preferable. > > Isn't there any concept of Application variables like in ASP. Or can i know > any ways of tracking session start and expiries ? > > Please lemme know if you guys have any alternatives. > > thanks, > guru. > > "B.A.T. Svensson" <B.A.T.Svensson@lumc.nl> wrote in message > news:FC36BC0A298F59448477C5D7E1EDAD84DEF1DB@mail1.lumc.nl...

« previous php.windows (#19852) next »