This topic is locked
[SOLVED]

 Displaying a list of users that are currently logged in" Stopped working

9/11/2020 9:51:46 PM
PHPRunner General questions
M
Mark Kramer author

I use the code below from the "Displaying a list of users that are currently logged in" tutorial
Everything worked great then it stopped. Was there a change in the code that makes this not work?
Thanks in advance
<?php
$minutes=10;

$dispUsers=20;

$t=date('Y-m-d H:i:s', time()-$minutes60);

// display users who were active in last 10 minutes
$users=DBLookup("select count(
) from invusers where lastaccess > '".$t."'");

if ($users>0) {

$sql="select * from invusers where lastaccess > '".$t."'";

$rs=CustomQuery($sql);
if ($data = db_fetch_array($rs)) {

echo $users." active user(s): ".$data["username"];

}

$count=1;

while ($data = db_fetch_array($rs)) {

if ($count<$dispUsers) {

$count++;

echo ", ".$data["username"];

}

else {

echo " ...";

break;

}

}

}

?>

Sergey Kornilov admin 9/12/2020

You need to make sure that other parts of the code are still there, make sure that lastaccess field gets populated etc. The code itself is correct, you need to figure out what has changed.

M
Mark Kramer author 9/13/2020



You need to make sure that other parts of the code are still there, make sure that lastaccess field gets populated etc. The code itself is correct, you need to figure out what has changed.


It looks as if the hosting provider changed time zones on me. I changed them back and now it works..
Thanks for the follow up and verification of the code.