Jump to content

Recommended Posts

  • Replies 94
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

this is so much easier working directly

 

ok updated (again)

 

<?php
$id = $_SESSION['tznUserId'];
$time=time();
$timeout=time()+(60*60); #now+1hour
mysql_query("UPDATE `surv_member` SET timestamp='$timeout' WHERE memberId='$id' LIMIT 1");

$query=mysql_query("SELECT * FROM `surv_member` WHERE `timestamp`>='$time'") or die(mysql_error());
$display = array();
while($row=mysql_fetch_array($query))
{
$display[] = $row['username'];
}

//spit out the results
mysql_close();
foreach($display as $d)
{
print "$d<br />";
}
?>

 

 

Still did not output any message =/

 

btw. I appreciate it Shaun and TEchie

ok

 

na don't use mIRC or any IRc's

 

<?php
$id = $_SESSION['tznUserId'];
mysql_query("UPDATE `surv_member` SET timestamp=NOW() WHERE memberId='$id' LIMIT 1");

$query=mysql_query("SELECT * FROM `surv_member` WHERE (`timestamp`+60*60) >=  NOW()") or die(mysql_error());
$display = array();
while($row=mysql_fetch_array($query))
{
$display[] = $row['username'];
}

//spit out the results
mysql_close();
foreach($display as $d)
{
print "$d<br />";
}
?>

correct,

 

runs by time alone if they are inactive for an hour then they are off the list,

 

$query=mysql_query("SELECT * FROM `surv_member` WHERE (`timestamp`+60*60) >=  NOW()") or die(mysql_error());

 

change (`timestamp`+60*60) to (`timestamp`+30*60) for 30 minutes etc

Oh this is used for active members for in the last hour,

 

if you want then to be removed from the list on logout

add this to the logout

 

$id = $_SESSION['tznUserId'];
mysql_query("UPDATE `surv_member` SET timestamp=NOW() WHERE memberId='$id' LIMIT 1");

 

 

Oh this would work better

<?php
$query=mysql_query("SELECT * FROM `surv_member` WHERE `timestamp` <=  (NOW()-60*60)") or die(mysql_error());
?>

 

 

 

OK well i am drained, i need sleep, catch ya later

this means then that you have not got a field in your table surv_member called 'timestamp'

don't forget case sensitive. In phpmyadmin there is an export button on the top click this and click the

bottom button Go. You will have the text for creating the database table. show it to us.

 

Desmond.

 

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.