Glory
04-04-10, 10:43 AM
(This is a Php script dont include this part)
<? php
/* Configurations */
$host = 'server ip;
$host2 = 'mysql ip';
$ftp_port = '21';
$web_port = '80';
$cpan_port = '2082';
$sql_port = '3306';
$interval = time()+5;
$online = '<strong><font size="2" color="indigo">Online ^_^</font></strong>';
$offline = '<strong><font size="2" color="darkred">Offline ;_;</font></strong>';
#####################################
#
# DO NOT EDIT BELOW HERE READ PLEASE
#
####################
#################
/* Disable Error Reporting */
error_reporting(0);
/* Check Server Status, If Server Status Was Not Checked In Last $interval seconds */
if($_COOKIE["checked"] != "true")
{
/* Check Server Status */
$ftp = fsockopen($host, $ftp_port, $errno, $errstr, 1);
$web = fsockopen($host, $web_port, $errno, $errstr, 1);
$cpan = fsockopen($host, $cpan_port, $errno, $errstr, 1);
$sql = fsockopen($host2, $sql_port, $errno, $errstr, 1);
/* Workout Server Status & Set Cookie */
if(!$ftp){ $ftp_status = $offline; setcookie("ftp_status", "offline", $interval); } else { $ftp_status = $online; }
if(!$web){ $web_status = $offline; setcookie("web_status", "offline", $interval); } else { $web_status = $online; }
if(!$cpan){ $cpan_status = $offline; setcookie("cpan_status", "offline", $interval); } else { $cpan_status = $online; }
if(!$sql){ $sql_status = $offline; setcookie("sql_status", "offline", $interval); } else { $sql_status = $online; }
/* Set Cookie To Let The Script Know, Server Status is Checked */
setcookie("checked", "true", $interval);
}
else
if($_COOKIE["checked"] == "true")
{
/* Read Cookie Values */
if($_COOKIE["ftp_status"] == "offline"){ $ftp_status = $offline; } else { $ftp_status = $online; }
if($_COOKIE["web_status"] == "offline"){ $web_status = $offline; } else { $web_status = $online; }
if($_COOKIE["cpan_status"] == "offline"){ $cpan_status = $offline; } else { $cpan_status = $online; }
if($_COOKIE["sql_status"] == "offline"){ $sql_status = $offline; } else { $sql_status = $online; }
}
?>
<? php
/* Configurations */
$host = 'server ip;
$host2 = 'mysql ip';
$ftp_port = '21';
$web_port = '80';
$cpan_port = '2082';
$sql_port = '3306';
$interval = time()+5;
$online = '<strong><font size="2" color="indigo">Online ^_^</font></strong>';
$offline = '<strong><font size="2" color="darkred">Offline ;_;</font></strong>';
#####################################
#
# DO NOT EDIT BELOW HERE READ PLEASE
#
####################
#################
/* Disable Error Reporting */
error_reporting(0);
/* Check Server Status, If Server Status Was Not Checked In Last $interval seconds */
if($_COOKIE["checked"] != "true")
{
/* Check Server Status */
$ftp = fsockopen($host, $ftp_port, $errno, $errstr, 1);
$web = fsockopen($host, $web_port, $errno, $errstr, 1);
$cpan = fsockopen($host, $cpan_port, $errno, $errstr, 1);
$sql = fsockopen($host2, $sql_port, $errno, $errstr, 1);
/* Workout Server Status & Set Cookie */
if(!$ftp){ $ftp_status = $offline; setcookie("ftp_status", "offline", $interval); } else { $ftp_status = $online; }
if(!$web){ $web_status = $offline; setcookie("web_status", "offline", $interval); } else { $web_status = $online; }
if(!$cpan){ $cpan_status = $offline; setcookie("cpan_status", "offline", $interval); } else { $cpan_status = $online; }
if(!$sql){ $sql_status = $offline; setcookie("sql_status", "offline", $interval); } else { $sql_status = $online; }
/* Set Cookie To Let The Script Know, Server Status is Checked */
setcookie("checked", "true", $interval);
}
else
if($_COOKIE["checked"] == "true")
{
/* Read Cookie Values */
if($_COOKIE["ftp_status"] == "offline"){ $ftp_status = $offline; } else { $ftp_status = $online; }
if($_COOKIE["web_status"] == "offline"){ $web_status = $offline; } else { $web_status = $online; }
if($_COOKIE["cpan_status"] == "offline"){ $cpan_status = $offline; } else { $cpan_status = $online; }
if($_COOKIE["sql_status"] == "offline"){ $sql_status = $offline; } else { $sql_status = $online; }
}
?>