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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.