10-13-2011, 11:38 AM
Here is the exact coding I use for Server Status, Users Online, Accounts Created, also a small rates part as well and Castle Owner reader.
NOTE: I have done a db cleanup I no longer have newproject_db_auth as I have merged it to be more organised with coding, I also wont release the sql dump due to customised tables etc for security.
<?
$CountOnlineUsersQuery = MySQL_Query("SELECT a_zone_num FROM t_users WHERE a_zone_num > -1");
$CountUsers = Mysql_Num_Rows($CountOnlineUsersQuery);
$CountAccounts = 0;
$CountAccountsQuery = Mysql_Query("SELECT * from bg_user");
WHILE ($AccountRows = MySQL_Fetch_Array($CountAccountsQuery)) {
$CountAccounts++;
}
$ServerIP = "PUT SERVER IP HERE";
$ServerPort = "4110";
$Sockres = @FSockOpen($ServerIP, $ServerPort, $errno, $errstr, 1);
if (!$Sockres) {
$Status = "Offline";
}
else {
@FClose($Sockres);
$Status = "Online";
}
echo"
Server Status: $Status
Users Online: $CountUsers
Accounts: $CountAccounts
";
$GetMeracCastleOwnerQuery = Mysql_Query("SELECT a_owner_guild_name FROM t_castle WHERE a_zone_index = 7");
$GetMeracCastleOwnerFetch = Mysql_Fetch_Array($GetMeracCastleOwnerQuery);
$MeracOwner = $GetMeracCastleOwnerFetch[a_owner_guild_name];
$GetDratanCastleOwnerQuery = Mysql_Query("SELECT a_owner_guild_name FROM t_castle WHERE a_zone_index = 4");
$GetDratanCastleOwnerFetch = Mysql_Fetch_Array($GetDratanCastleOwnerQuery);
$DratanOwner = $GetDratanCastleOwnerFetch[a_owner_guild_name];
IF ($MeracOwner == NULL) {
$MeracOwner = "NO GUILD";
}
IF ($DratanOwner == NULL) {
$DratanOwner = "NO GUILD";
}
echo"
Merac Owner: $MeracOwner
Dratan Owner: $DratanOwner
Rates:
Exp: x1
SP: x1
Drop: x1
Gold: x1
";
?>

