/************************************************************************/ /* Squery 4.0.1 PHPNuke Module */ /* ================================================= */ /* */ /* Copyright (c) 2004 Curtis Brown (webmaster@squery.com) */ /* http://www.squery.com */ /* */ /* */ /* This Module allows users to query from your PHPNuke Website. */ /* The module is required to be present for the Block to work, however */ /* It is not necessary that it be active */ /* */ /************************************************************************/ /* ADMIN SECTION - Sql Integration - Block Modification */ /* */ /* Author: XenoMorpH ¤TŠI¤ (aarvuijk@hotmail.com) */ /* Development Assistance: CrazyCrack (support@phpnuke-clan.com) */ /* Made for PNC phpnuke-clan.com & SQuery.com */ /************************************************************************/ if (!eregi("modules.php", $_SERVER['PHP_SELF'])) { die ("You can't access this file directly..."); } require_once("mainfile.php"); global $prefix; $module_name = basename(dirname(__FILE__)); $numservers= mysql_numrows(mysql_query("SELECT * FROM ".$prefix."_squery_servers WHERE hideserver=1")); // check out main.lib.php for configuration and more information error_reporting(0); // redefine the user error constants - PHP 4 only define("FATAL", E_ERROR); define("ERROR", E_WARNING); define("WARNING", E_NOTICE); define("OTHER", E_PARSE); // error handler function function myErrorHandler($errno, $errstr, $errfile, $errline) { echo ""; } // set to the user defined error handler $old_error_handler = set_error_handler("myErrorHandler"); // globalize our vars :0 $ip = $_GET['ip']; $port = $_GET['port'];$qgame = $_GET['game']; $libpath="./SQuery/lib/"; // require our main library =) require($libpath.'main.lib.php'); ////////////////////////////////////////////////////////// function queryServer($address, $port, $protocol) { global $libpath; include_once($libpath."gsQuery.php"); if(!$address && !$port && !$protocol) { echo "No parameters given\n"; return FALSE; } $gameserver=gsQuery::createInstance($protocol, $address, $port); if(!$gameserver) { echo "Could not instantiate gsQuery class. Does the protocol you've specified exist?\n"; return FALSE; } if(!$gameserver->query_server(TRUE, TRUE)) { // fetch everything // query was not succesful, dumping some debug info echo "
if (!$static_ip) {
?>
} else { // doing static IP $ip = $static_ip; $port = ($static_port ? $static_port : "2302"); $qgame = $static_game; foreach($gametable as $key=>$value) { if ($key==$qgame) { $enginetype=$value; } } } if ($ip && $port) { ?>
Spectators: $o = 0; for ($i=0;$i<$gameserver->numplayers;$i++) { if ($gameserver->playerteams[$i] == "3") { $o++; echo $gameserver->htmlize($gameserver->players[$i]["name"]); if ($o < $gameserver->spec) echo ", "; } } if ($o == 0) echo "(none)"; ?> } } else { echo "We were unable to contact the server you requested, it is most likely Offline"; } ?> |