Junior Spellweaver
- Joined
- Jan 5, 2009
- Messages
- 128
- Reaction score
- 12
SInce i want to help this community a little I want to release my online script code for website. I don't know if someone have something like this but well. SO what the script will do? Easy it will show the users who logged in the last 5 hours, yet I didn't find any way only this one.
Code:
BTW the config2.php contains just the connection to db_game;
Addablo
Code:
Code:
<?php
require_once('config2.php');
$connect = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$connect) {
die('Failed to connect to server: ' . mysql_error());
}
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
$query="SELECT * FROM t_user";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
$k=0;
$time2=time() - 5 * 60 * 60;
while ($i < $num) {
$field1=mysql_result($result,$i,"lastupdatetime");
$time1=$field1;
if($field1 > $time2)
$k++;
$i++;
}
echo '<font color=white size=5>Online Users</font><hr/>';
echo '
<font color=white>Users Online in the last 5 hours:</font>'; echo "<font color=white>$k</a>";
?>
Addablo
You must be registered to see links
Last edited by a moderator: