Jump to content
GIGN Forum

Monitors


aaE
 Share

Recommended Posts

Monitors viss iet, bet bildes nerada, kas nav kartiba?

<?PHP

/*---------------------------------------------------+

| PHP-Fusion 6 Content Management System

+----------------------------------------------------+

| Copyright ? 2002 - 2008 Nick Jones

| http://www.php-fusion.co.uk/

+----------------------------------------------------+

| PHP-Fusion Counter-Strike monitoring panel ver. 1.2|

+----------------------------------------------------+

| Tested with Counter-Strike hlds ver. 33

+----------------------------------------------------+

| Ported and Modified for PHP-Fusion by Sere}l{ka

| mailto: [email protected]

+----------------------------------------------------+

| Place this code into a folder under Infusions

| Make sure the folder and the filename are identical

| then add your panel.

+----------------------------------------------------*/

include_once "settings.php";

if (!defined("IN_FUSION")) { header("Location:../../index.php"); exit; }

openside("Deagl3 | 47/48p");

//-----------------Parametri -------------------//

$maps_dir = IMAGES."deagl3.oo.lv/maps"; //Karрu adreses

$data = monitor_server_cs("78.84.3.139", 27015, "halflife", "info"); // Servera parametri

$img = $maps_dir.$data['mapname'].".jpg";

if (file_exists($img)) {} else {$img = $maps_dir."no_image.jpg";}

function monitor_server_cs($ip, $port, $game, $request)

{

$fp = @fsockopen("udp://$ip", $port, $errno, $errstr, 1);

if (!$fp) { return FALSE; }

stream_set_timeout($fp, 1, 0);

stream_set_blocking($fp, true);

if (($request == "settings" || $request == "players"))

{

$challenge_code = "\xFF\xFF\xFF\xFF\x57";

fwrite($fp, $challenge_code);

$buffer = fread($fp, 4096);

if (!trim($buffer)) { fclose($fp); return FALSE; }

$challenge_code = substr($buffer, 5, 4);

}

if ($request == "info") { $challenge = "\xFF\xFF\xFF\xFFTSource Engine Query\x00"; }

if ($request == "players") { $challenge = "\xFF\xFF\xFF\xFFU".$challenge_code; }

if ($request == "settings") { $challenge = "\xFF\xFF\xFF\xFFV".$challenge_code; }

fwrite($fp, $challenge);

$buffer = fread($fp, 4096);

if (!$buffer) { fclose($fp); return FALSE; }

if ($request == "settings")

{

$second_packet = fread($fp, 4096);

if (strlen($second_packet) > 0)

{

$reverse_check = dechex(ord($buffer[8]));

if ($reverse_check[0] == "1")

{

$tmp = $buffer;

$buffer = $second_packet;

$second_packet = $tmp;

}

$buffer = substr($buffer, 13);

$second_packet = substr($second_packet, 9);

$buffer = trim($buffer.$second_packet);

}

else

{

$buffer = trim(substr($buffer, 4));

}

}

else

{

$buffer = trim(substr($buffer, 4));

}

fclose($fp);

if (!trim($buffer)) { return FALSE; }

/*--------------------Ñòàíдàðòíàÿ èíôîðìàцèÿ î ñеðâеðе----------------------------*/

if ($request == "info")

{

unset($data);

$tmp = explode("\x00", $buffer);

$place = strlen($tmp[0].$tmp[1].$tmp[2].$tmp[3].$tmp[4]) + 5;

$data['gamemod'] = $tmp[3];

$data['hostname'] = $tmp[1];

$data['mapname'] = $tmp[2];

$data['players'] = ord($buffer[$place]);

$data['maxplayers'] = ord($buffer[$place + 1]);

$data['password'] = ord($buffer[$place + 5]);

// $data['cs_players'] = $cs_players;

/*----------Íе ñòàíдàðòíàÿ èíôîðìàцèÿ. Íе èñïîëьçуеòñÿ.----------------------------*/

$data['datatype'] = $buffer[0]; // m for steam info

$data['version'] = ord($buffer[$place + 2]); // Network Version

$data['description'] = $tmp[4];

$data['server_type'] = $buffer[$place + 3]; // D edicated or L isten

$data['server_os'] = $buffer[$place + 4]; // W indows or L inux

$data['server_secure'] = ord($tmp[14]); // VAC

$data['server_bots'] = ord($tmp[15]); // Number of Bots

/*--------------------------------------------------------*/

return $data;

}

/*--------------------------------------------------------*/

if ($request == "players")

{

$player_number = 0;

$position = 2;

do

{

$player_number++;

$player[$player_number]['id'] = ord($buffer[$position]);

$position ++;

while($buffer[$position] != "\x00" && $position < 4000)

{

$player[$player_number]['name'] .= $buffer[$position];

$position ++;

}

$player[$player_number]['score'] = (ord($buffer[$position + 1]))

+ (ord($buffer[$position + 2]) * 256)

+ (ord($buffer[$position + 3]) * 65536)

+ (ord($buffer[$position + 4]) * 16777216);

if ($player[$player_number]['score'] > 2147483648) { $player[$player_number]['score'] -= 4294967296; }

$time = substr($buffer, $position + 5, 4);

if (strlen($time) < 4) { return FALSE; }

list(,$time) = unpack("f", $time);

$time = mktime(0, 0, $time);

$player[$player_number]['time'] = date("H:i:s", $time);

$position += 9;

}

while ($position < strlen($buffer));

return $player;

}

/*---------------------------------------------------------*/

if ($request == "settings")

{

$tmp = substr($buffer, 2);

$rawdata = explode("\x00", $tmp);

for($i=1; $i<count($rawdata); $i=$i+2)

{

$rawdata[$i] = strtolower($rawdata[$i]);

$setting[$rawdata[$i]] = $rawdata[$i+1];

}

return $setting;

}

}

/*--------------Âûâîд èíôîðìàцèè î ñеðâеðе------------------*/ // èçìеíèòе àдðеñ_âàёеãî_ñàйòà è 127.0.0.1 íà IP àдðеñ ñеðâеðà!

$server_cs = "<center>

<img src=\"". $img ."\" width=\"160\" height=\"120\" style=\"border:1px solid #000000;\"><br>

Adrese: <b><font color=#119911>78.84.3.139:27015</font></b> <br>

Spзlзtвji: <b>".$data['players']."/".$data['maxplayers']."</b> <br>

Karte: <b>".$data['mapname']."</b>

<script language=\"JavaScript\">

function winop_cs()

{

winop_cs = window.open(\"http://90.130.160.98/infusions/cs_monitoring_panel/server_players.php\",\"mywin\" ,\"height=400,width=350 ,scrollbars=yes\");

}

</script>

<center>

<a href=\"java script:winop_cs();\"><b><font color=\"red\">Kas spзlз ?</font></b></a>

</center>";

/*--------------Âûâîд èíôîðìàцèè è çàêðûòèе áëîêà----------*/

echo "$server_cs";

closeside();

?>

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...