TheJeffsta
New Member
- Messages
- 984
- Reaction score
- 0
- Points
- 0
OK, currently I have set up a server status page, using the code from another post.
The code at the top is the ad code, the code right at the bottom is a code to automatically refresh the page every 10 seconds.
The code posted above works perfectly but I want to change the
and
to display the images (http://www.thejeffsta.x10hosting.com/Status/offline.gif and http://www.thejeffsta.x10hosting.com/Status/offline.gif) - the script page is hosted in my /Status/ directory (set to not show contents via HTTP).
If you could please tell me how to do it, It would be much appreciated.
Code:
<center><script language='JavaScript' type='text/javascript' src='http://x10hosting.com/advert/adx.js'></script>
<script language='JavaScript' type='text/javascript'>
<!--
if (!document.phpAds_used) document.phpAds_used = ',';
phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
document.write ("http://x10hosting.com/advert/adjs.php?n=" + phpAds_random);
document.write ("&what=zone:1&target=_blank");
document.write ("&exclude=" + document.phpAds_used);
if (document.referrer)
document.write ("&referer=" + escape(document.referrer));
document.write ("'><" + "/script>");
//-->
</script><noscript><a href='http://x10hosting.com/advert/adclick.php?n=a7fb3e9d' target='_blank'><img src='http://x10hosting.com/advert/adview.php?what=zone:1&n=a7fb3e9d' border='0' alt=''></a></noscript></center>
<p></p>
<p align="center"><u><b><font size="7">x10Hosting Free Hosting Server Status</font></b></u>
<p></p>
<?
error_reporting(0);
$IP = array(
"HTTP" => "70.86.136.178:80",
); while(list($ServerName,$Host)=each($IP)) {
list($IPAddress,$Port)=explode(":",$Host);
if($fp=fsockopen($IPAddress,$Port,$ERROR_NO,$ERROR_STR,(float)0.5)) {
echo("<font color=\"black\"><b>HTTP</b> - <font color=\"green\"><b>Online</b></font>");
fclose($fp);
}
else {
echo ("<font color=\"black\"><b>HTTP</b> - <font color=\"red\"><b>Offline</b></font>");
}
echo ("");
}
?>
<p></p>
<?
error_reporting(0);
$IP = array(
"FTP" => "70.86.136.178:25",
); while(list($ServerName,$Host)=each($IP)) {
list($IPAddress,$Port)=explode(":",$Host);
if($fp=fsockopen($IPAddress,$Port,$ERROR_NO,$ERROR_STR,(float)0.5)) {
echo("<font color=\"black\"><b>FTP</b> - <font color=\"green\"><b>Online</b></font>");
fclose($fp);
}
else {
echo ("<font color=\"black\"><b>FTP</b> - <font color=\"red\"><b>Offline</b></font>");
}
echo ("");
}
?>
<p></p>
<?
error_reporting(0);
$IP = array(
"MySQL" => "70.86.136.178:3306",
); while(list($ServerName,$Host)=each($IP)) {
list($IPAddress,$Port)=explode(":",$Host);
if($fp=fsockopen($IPAddress,$Port,$ERROR_NO,$ERROR_STR,(float)0.5)) {
echo("<font color=\"black\"><b>MySQL</b> - <font color=\"green\"><b>Online</b></font>");
fclose($fp);
}
else {
echo ("<font color=\"black\"><b>MySQL</b> - <font color=\"red\"><b>Offline</b></font>");
}
echo ("");
}
?>
<p></p>
<?
error_reporting(0);
$IP = array(
"POP3" => "70.86.136.178:110",
); while(list($ServerName,$Host)=each($IP)) {
list($IPAddress,$Port)=explode(":",$Host);
if($fp=fsockopen($IPAddress,$Port,$ERROR_NO,$ERROR_STR,(float)0.5)) {
echo("<font color=\"black\"><b>POP3</b> - <font color=\"green\"><b>Online</b></font>");
fclose($fp);
}
else {
echo ("<font color=\"black\"><b>POP3</b> - <font color=\"red\"><b>Offline</b></font>");
}
echo ("");
}
?>
<p></p>
<?
error_reporting(0);
$IP = array(
"SMTP" => "70.86.136.178:25",
); while(list($ServerName,$Host)=each($IP)) {
list($IPAddress,$Port)=explode(":",$Host);
if($fp=fsockopen($IPAddress,$Port,$ERROR_NO,$ERROR_STR,(float)0.5)) {
echo("<font color=\"black\"><b>SMTP</b> - <font color=\"green\"><b>Online</b></font>");
fclose($fp);
}
else {
echo ("<font color=\"black\"><b>SMTP</b> - <font color=\"red\"><b>Offline</b></font>");
}
echo ("");
}
?>
<p></p>
<?
error_reporting(0);
$IP = array(
"cPanel" => "70.86.136.178:2082",
); while(list($ServerName,$Host)=each($IP)) {
list($IPAddress,$Port)=explode(":",$Host);
if($fp=fsockopen($IPAddress,$Port,$ERROR_NO,$ERROR_STR,(float)0.5)) {
echo("<font color=\"black\"><b>cPanel</b> - <font color=\"green\"><b>Online</b></font>");
fclose($fp);
}
else {
echo ("<font color=\"black\"><b>cPanel</b> - <font color=\"red\"><b>Offline</b></font>");
}
echo ("");
}
?>
<p></p>
<?
error_reporting(0);
$IP = array(
"DNS" => "70.86.136.178:53",
); while(list($ServerName,$Host)=each($IP)) {
list($IPAddress,$Port)=explode(":",$Host);
if($fp=fsockopen($IPAddress,$Port,$ERROR_NO,$ERROR_STR,(float)0.5)) {
echo("<font color=\"black\"><b>DNS</b> - <font color=\"green\"><b>Online</b></font>");
fclose($fp);
}
else {
echo ("<font color=\"black\"><b>DNS</b> - <font color=\"red\"><b>Offline</b></font>");
}
echo ("");
}
?>
<p></p>
<?
error_reporting(0);
$IP = array(
"IMAP" => "70.86.136.178:143",
); while(list($ServerName,$Host)=each($IP)) {
list($IPAddress,$Port)=explode(":",$Host);
if($fp=fsockopen($IPAddress,$Port,$ERROR_NO,$ERROR_STR,(float)0.5)) {
echo("<font color=\"black\"><b>IMAP</b> - <font color=\"green\"><b>Online</b></font>");
fclose($fp);
}
else {
echo ("<font color=\"black\"><b>IMAP</b> - <font color=\"red\"><b>Offline</b></font>");
}
echo ("");
}
?>
<p></p>
<?
$uptime = @exec('uptime');
preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/", $uptime, $avgs);
$uptime = explode(' up ', $uptime);
$uptime = explode(',', $uptime[1]);
$uptime = $uptime[0] .', '. $uptime[1];
$start = mktime(0, 0, 0, 1, 1, date('Y'), 0);
$end = mktime(0, 0, 0, date('m'), date('j'), date('y'), 0);
$diff = $end - $start;
$days = @($diff / 86400);
$percentage = @($uptime / $days) * 100;
$load = $avgs[1] + $avgs[2] + $avgs[3];
$load = $load / 3;
$load = round($load, 3);
// $load holds the load.
echo "<b>Server Load</b> - $load%";
?>
<p></p>
<?
$uptime = shell_exec("cut -d. -f1 /proc/uptime");
$days = floor($uptime/60/60/24);
$hours = $uptime/60/60%24;
$mins = $uptime/60%60;
$secs = $uptime%60;
echo "<b>Server Uptime</b> - $days days, $hours hours, $mins minutes and $secs seconds";
?>
<script>
<!--
/*
Auto Refresh Page with Time script
By JavaScript Kit (javascriptkit.com)
Over 200+ free scripts here!
*/
//enter refresh time in "minutes:seconds" Minutes should range from 0 to inifinity. Seconds should range from 0 to 59
var limit="0:10"
if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+" minutes and "+cursec+" seconds left until page refresh!"
else
curtime=cursec+" seconds left until page refresh!"
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}
window.onload=beginrefresh
//-->
</script>
The code at the top is the ad code, the code right at the bottom is a code to automatically refresh the page every 10 seconds.
The code posted above works perfectly but I want to change the
Code:
<font color=\"red\"><b>Offline</b></font>
Code:
<font color=\"red\"><b>Online</b></font>
If you could please tell me how to do it, It would be much appreciated.