GOLDSRC / 1 -> SOURCE $szAddress = $_GET[ 'Address' ]; $szExploded = explode( ":", $szAddress ); $szServerIP = $szExploded[ 0 ]; $szServerPort = $szExploded[ 1 ]; $Query = new SourceQuery( ); $Info = Array( ); $Rules = Array( ); $Players = Array( ); try { $Query -> Connect( $szServerIP, $szServerPort, DEF__TIME_OUT, $iEngine ); $Info = $Query -> GetInfo( ); $Players = $Query -> GetPlayers( ); $Rules = $Query -> GetRules( ); } catch( Exception $e ) { $Exception = $e; } $Query -> Disconnect( ); header( "Content-type: image/png" ); $rImage = imagecreatefrompng( DEF__IMAGE_NAME ); $iColor = imagecolorallocate( $rImage, DEF__COLOR_RED, DEF__COLOR_GREEN, DEF__COLOR_BLUE ); // bool imagestring ( resource $image , int $font , int $x , int $y , string $string , int $color ) imagestring( $rImage, DEF__ADDRESS_TEXT_SIZE, DEF__ADDRESS_X, DEF__ADDRESS_Y, $szAddress, $iColor ); if( $Info[ 'MaxPlayers' ] != 0 ) { if( strlen( $szHostName ) > DEF__HOSTNAME_MAX_TEXT_LEN ) { $szHostName = substr( $Info[ 'HostName' ], 0, DEF__HOSTNAME_MAX_TEXT_LEN ). ' ...'; } if( strlen( $szMapName ) > DEF__MAP_MAX_TEXT_LEN ) { $szMapName = substr( $szMapName, 0, DEF__MAP_MAX_TEXT_LEN ). '..'; } imagestring( $rImage, DEF__HOSTNAME_TEXT_SIZE, DEF__HOSTNAME_X, DEF__HOSTNAME_Y, $szHostName, $iColor ); imagestring( $rImage, DEF__MAP_TEXT_SIZE, DEF__MAP_X, DEF__MAP_Y, $szMapName, $iColor ); imagestring( $rImage, DEF__PLAYERS_TEXT_SIZE, DEF__PLAYERS_X, DEF__PLAYERS_Y, $Info[ 'Players' ]. '/' .$Info[ 'MaxPlayers' ], $iColor ); } else { imagestring( $rImage, DEF__PLAYERS_TEXT_SIZE, DEF__PLAYERS_X, DEF__PLAYERS_Y, "TS-Big.pl", $iColor ); } imagepng( $rImage ); imagedestroy( $rImage ); imagedestroy( $rIcon ); } ?>