Jump to content

[SOLVED] making who is online script


jck

Recommended Posts

my login system works like this is there anyway i can make a who is online script

 

<?
require_once("conn.php");

if(isset($_POST[s1]))
{
$q1 = "select * from dd_users where username = '$_POST[u1]' and password = '$_POST[p1]' ";
$r1 = mysql_query($q1) or die(mysql_error());

if(mysql_num_rows($r1) == '1')
{
	$_SESSION[username] = $_POST[u1];
	header("location:index.php");
	exit();
}
}

//get the templates
require_once("templates/MainHeader.php");
require_once("templates/MainLogin.php");
require_once("templates/MainFooter.php");

?>

Link to comment
https://forums.phpfreaks.com/topic/59919-solved-making-who-is-online-script/
Share on other sites

All you need do is, as your users login add them to a table logged in along with a timestamp of when they logged in. This timestamp will then need to be updated on each request made by the user.

 

Then, simply run a cron every 5 mins or so that deletes entries older than five minutes.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.