-
Server Status
Like 2 months ago i asked a question but noone answered
How to set up server status on my website?
The one that would shop up how many players are online atm, how many accounts registered on the server, and the stat saying if server is online or offline
Please answer
Thx in advance
-
1 Attachment(s)
Re: Server Status
well theres a script that already has the "server stat" page, this requires PHP knowledge
its already made, "exept the number of accs registered on the server part"
thats pretty easy though, anyways below is the script by trash along time ago it still works great, it will display number of usesrs online, and server status. modify it to your mysql server if your running the site on the same server leave local host alone, if it doesnt work change local host to 127.0.0.1 because you most likely dont have localhost defined in the hosts file.
to add the file, add it to your www location in ur server. change .txt to .php and save then your done.
-
Re: Server Status
-
Re: Server Status
-
Re: Server Status
PHP Code:
<?
$CountOnlineUsersQuery = MySQL_Query("SELECT uid from point where zoneid>-1");
$CountUsers = 0;
WHILE ($UserRows = MySQL_Fetch_Array($CountOnlineUsersQuery)) {
$CountUsers++;
}
$CountAccounts = 0;
$CountAccountsQuery = Mysql_Query("SELECT ID from users where ID>-1");
WHILE ($AccountRows = MySQL_Fetch_Array($CountAccountsQuery)) {
$CountAccounts++;
}
$ServerIP = "IP HERE"; // IP your PW Server
$ServerPort = "PORT HERE"; // Port your PW Server
$Sockres = @FSockOpen($ServerIP, $ServerPort, $errno, $errstr, 1);
if (!$Sockres) {
$Count = 0;
$Status = "<font color=red>Offline</font>";
}
else {
@FClose($Sockres);
$Status = "<font color=green>Online</font>";
}
echo"
<b>Server:</b> $Status <br>
<b>Users Online:</b> $CountUsers <br>
<b>Accounts:</b> $CountAccounts <br>
<br>
<b>Rates:</b><br>
<b>Exp:</b> x9999 <br>
<b>SP:</b> x9999 <br>
<b>Drop:</b> x9999 <br>
<b>Gold:</b> x9999 <br>";
?>