Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Release]Online Players Script !

Status
Not open for further replies.
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:

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>";

?>
BTW the config2.php contains just the connection to db_game;


Addablo
 
Last edited by a moderator:
Junior Spellweaver
Joined
May 12, 2012
Messages
109
Reaction score
9
You cant advertise your server in a Release,!
 
Status
Not open for further replies.
Back
Top