08-29-2009, 10:14 AM
Just looking for a simple script that checks the server status... here is a perfect one for teamspeak:
I want this but for my source server
Code:
<?php
function check_ts($ip, $tcp, $udp, $timeout=1) { //Function for the Check
$fp = @fsockopen($ip, $tcp, $errno, $errstr, $timeout);
if (!$fp) {
$stat = false;
} else {
if (fgets($fp) == "[TS]\r\n") {
fputs($fp, "SEL $udp\r\n");
if (fgets($fp) == "OK\r\n") {
$stat = true;
} else {
$stat = false;
}
} else {
$stat = false;
}
if (is_resource($fp))
@fclose($fp);
return $stat;
}
}
if (check_ts("localhost", 51234, 8767)) { //Change IP, Query-Port and TS-Port
echo "<FONT COLOR=#00DD00><B>ONLINE</B></FONT>";
} else {
echo "<FONT COLOR=#DD0000><B>OFFLINE</B></FONT>";
}
?>
I want this but for my source server
