From 40dfa7d5c0dc8e4cb2c95e403b6b4b2c4bf70644 Mon Sep 17 00:00:00 2001 From: Matthijs Kuiper Date: Sat, 4 Feb 2017 16:05:45 +0100 Subject: Original UTStats beta 4.2.8 --- html/pages/servers_query.php | 176 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100755 html/pages/servers_query.php (limited to 'html/pages/servers_query.php') diff --git a/html/pages/servers_query.php b/html/pages/servers_query.php new file mode 100755 index 0000000..95265c6 --- /dev/null +++ b/html/pages/servers_query.php @@ -0,0 +1,176 @@ +\n"; + exit; +} + +fputs($sock,"\\status\\\player_property\Health\\\game_property\ElapsedTime\\\game_property\RemainingTime\\"); + +$gotfinal = False; +$data = ""; + +//Set starttime, for possible loop expiration, so the server doesn't get too much work. +$starttime = Time(); + +//Loop until final packet has been received. +while(!($gotfinal == True || feof($sock))) { + + //Get data + if(($buf = fgetc($sock)) == FALSE) { + usleep(100); // wait for additional data? :S whatever + } + + //Add to databuffer + $data .= $buf; + + //Check if final item (queryid) has been received + if (strpos($data,"final\\") != False) { + $gotfinal = True; + } + + //Protect webserver against massive loop. + if ((Time() - $starttime) > 5) { + echo "Data receiving took too long. Cancelled.

"; + $gotfinal = True; + } +} + +//Close socket +fclose ($sock); + + +//Split chunks by \ +$chunks = split('[\]', $data); + +$mappic = strtolower("images/maps/".$map.".jpg"); + +if (file_exists($mappic)) { +} else { + $mappic = ("images/maps/blank.jpg"); +} + +$mapname = getiteminfo("mapname",$chunks); +$mappic = strtolower("images/maps/".$mapname.".jpg"); +IF (file_exists($mappic)) { + } else { + $mappic = "images/maps/blank.jpg"; +} + +$r_hostname = getiteminfo("hostname",$chunks); +$r_gametype = getiteminfo("gametype",$chunks); + +$r_adminname = getiteminfo("adminname",$chunks); +$r_adminemail = getiteminfo("adminemail",$chunks); + +$r_password = getiteminfo("password",$chunks); +$r_timelimit = getiteminfo("timelimit",$chunks); +$r_remainingtime = GetMinutes(getiteminfo("RemainingTime",$chunks)) . " mins"; +$r_elapsedtime = GetMinutes(getiteminfo("ElapsedTime",$chunks)) . " mins"; + +$r_goalteamscore = getiteminfo("goalteamscore",$chunks); +$r_numplayers = getiteminfo("numplayers",$chunks); +$r_minplayers = getiteminfo("minplayers",$chunks); +$r_maxplayers = getiteminfo("maxplayers",$chunks); +$r_maxteams = getiteminfo("maxteams",$chunks); + +$r_balanceteams = getiteminfo("balanceteams",$chunks); +$r_tournament = getiteminfo("tournament",$chunks); +$r_friendlyfire = getiteminfo("friendlyfire",$chunks); +$r_gamestyle = getiteminfo("gamestyle",$chunks); + +echo' + + + + + + + + + + + + + + + + + + + + + + + + + +
Server Status for '.$r_hostname.'
Server IP'.$serverip.':'.$serverport.''.$mapname.'
Map Name'.$mapname.'
Match Type'.$r_gametype.'
Server InfoAdmin: '.$r_adminname.'
Email: '.$r_adminemail.'
Game Info + Goal Team Score: '.$r_goalteamscore.'
+ Min Players: '.$r_minplayers.'
+ Max Players: '.$r_maxplayers.'
+ Max Teams: '.$r_maxteams.'
+ Balanced Teams: '.$r_balanceteams.'
+ Tournament Mode: '.$r_tournament.'
+ Friendly Fire: '.$r_friendlyfire.'
+ Game Style: '.$r_gamestyle.'

+ Time Limit: '.$r_timelimit.'
+ Time Remaining: '.$r_remainingtime.'
+ Time Elapsed: '.$r_elapsedtime.'
+ Password Required: '.$r_password.'
+
+
+ + + + + + + + + + + + + '; + +//Loop through all players +for ($i = 0; $i < $r_numplayers; $i++) { + $actualid = $i; + $itemx = $i+1; + + $r_playername = getiteminfo("player_" . $actualid,$chunks); + $r_playerfrags = getiteminfo("frags_" . $actualid,$chunks); + $r_playerteam = getiteminfo("team_" . $actualid,$chunks); + $r_playerping = getiteminfo("ping_" . $actualid,$chunks); + $r_playerhealth = getiteminfo("Health_" . $itemx,$chunks); + + echo' + + + + + + '; +} + +echo'
Player Information
PlayerFragsTeamPingHealth
'.$r_playername.''.$r_playerfrags.''.$r_playerteam.''.$r_playerping.''.$r_playerhealth.'
'; +?> \ No newline at end of file -- cgit