document.write("
<?php
$spiel = "";
$ip = "";
$port = " ";
// Define your servers,
// see list.php for all supported games and identifiers.
if(!empty($_POST['ip']) && !empty($_POST['spiel']))
{
$spiel = $_POST['spiel'];
$ip = $_POST['ip'];
$port = $_POST['port'];
}
if(empty($_POST['ip']) && empty($_POST['spiel']))
{
$spiel = $_GET['spiel'];
$ip = $_GET['ip'];
if(isset($_GET['port'])){ $port = $_GET['port']; }else{ $port = ""; }
}
error_reporting(E_ALL);
$errorstring = "";
require_once 'GameQ.php';
$spiel = "";
$ip = "";
$port = " ";
// Define your servers,
// see list.php for all supported games and identifiers.
if(!empty($_POST['ip']) && !empty($_POST['spiel']))
{
$spiel = $_POST['spiel'];
$ip = $_POST['ip'];
$port = $_POST['port'];
}
if(empty($_POST['ip']) && empty($_POST['spiel']))
{
$spiel = $_GET['spiel'];
$ip = $_GET['ip'];
if(isset($_GET['port'])){ $port = $_GET['port']; }else{ $port = ""; }
}
if(empty($ip))
{
$errorstring = "Gib eine IP ein!!";
}else{
if(empty($port))
{
$servers = array(
'Gamers Pic' => array("$spiel", "$ip")
);
}else{
$servers = array(
'Gamers Pic' => array("$spiel", "$ip", $port)
);
}
// Call the class, and add your servers.
$gq = new GameQ();
$gq->addServers($servers);
// You can optionally specify some settings
$gq->setOption('timeout', 200);
// You can optionally specify some output filters,
// these will be applied to the results obtained.
$gq->setFilter('normalise');
$gq->setFilter('sortplayers', 'gq_ping');
// Send requests, and parse the data
$results = $gq->requestData();
}
// Some functions to print the results
function print_results($results) {
foreach ($results as $id => $data) {
print_table($data);
}
}
function print_table($data) {
$gqs = array('gq_online', 'gq_address', 'gq_port', 'gq_prot', 'gq_type');
if (!$data['gq_online']) {
printf("document.write(\"<p>The server did not respond within the specified time.</p>\n\");");
return;
}
echo '<table><tr><td><b>Variable</b></td><td><b>Value</b></td></tr><tbody>';
foreach ($data as $key => $val) {
if (is_array($val)) continue;
$cls = empty($cls) ? '' : '';
if (substr($key, 0, 3) == 'gq_') {
$kcls = (in_array($key, $gqs)) ? 'always' : 'normalise';
$key = sprintf("", $kcls, $key);
}
printf("<tr><td>%s</td><td>%s</td></tr>\n", $key, $val);
}
echo '</tbody></table>';
}
?>
<?php
print_results($results);
?>
");