<?php
     
/*
        Written By Benjamin Waldher
        E-Mail: lgbr-web@laserbunny.net
        
        The distribution of this software is available free of charge, and comes with NO WARRANTY.
    */

    //Change these variables!
    
$ip "0.0.0.0";
    
$port 27015;    //This comes after the colon in the IP address, example: 67.19.248.162:27015
    
    //You're done, leave the rest be
    
$fp fsockopen("udp://$ip",$port);        //Connect to the server

    
fwrite($fp,"\xff\xff\xff\xffplayers\x00");
    
fread($fp,5);
    
    
$playercount ord(fread($fp,1));        //Get the number of players

    
echo "<b>Players: </b>" $playercount "\n<br>";

    echo 
"<br>\n<table border=1>";
    echo 
"\n<tr><td>#</td><td>Name</td><td>Score</td><td>Time</td></tr>";

    for(
$i 0$i $playercount$i++){        //Get the data for each player
        
echo "\n<tr>";
        
        echo 
"<td>" ord(fread($fp,1)) . "</td>";
        
        
$string "";
        while(
1){
            
$byte fread($fp,1);
            if(!
ord($byte)) break;
            
$string .= $byte;
        }
        echo 
"\n<td>$string</td>";
        
        
$score ord(fread($fp,1)) + (ord(fread($fp,1)) << 8) + (ord(fread($fp,1)) << 16) + (ord(fread($fp,1)) << 24);

        echo 
"\n<td>$score</td>";

        
$timebuff unpack("ftime",fread($fp,4));
        
$time date("H:i:s",round($timebuff['time'],0));
        echo 
"\n<td>$time</td>";
        echo 
"\n</tr>";
    }
    echo 
"</table>";

    echo 
"\n<br>\n<br><a href='"$_SERVER['PHP_SELF']."s'>Source Code</a>";
?>