Jumat, 04 April 2008

PHP PING YANG SUDAH DI MODIFIKASI

<?php

function PING($domain){
$starttime = microtime(true);
$file= fsockopen($domain, 80, $errno, $errstr,10);
$stoptime = microtime(true);
$status = 0;

if (!$file)$status = -1;
else{
fclose($file);
error_reporting(0);
$status = ($stoptime - $starttime) * 1000;
$status = floor($status);
}
return $status;
}
?>

<html>
<head><title>Web Browser Ping</title><script language="JavaScript">var a1 = " Web ";var a2 = " Ping ";var delay = 1000;b1();function b1() {ID = setTimeout("b2()",delay);document.title = (a1);}function b2() {ID = setTimeout("b1()",delay);document.title = (a2);}</script>
</head>
<script type="text/javascript" language="javascript">
var timercount = 0;
function startTimer() {
if(timercount<10)
timercount='0'+timercount;
setTimeout('startTimer()',1000);
timercount++;
document.getElementById('timer_cage').innerHTML = 10 - timercount;
if(timercount==10) {
timercount = 0;
}
}
</script>
<?php
$on="<img src=http://localhost/on.jpg width=13 height=13>";
$off="<img src=http://localhost/off.jpg width=13 height=13>";
?>
<body background="http://localhost/splash.gif" onLoad="startTimer()">
<center><font color="#FF0000" face="terminal" size="+2"><b><span id="timer_cage"></span></font></center>
<?php
echo "<center><font size=+3 face=arial color=#adadeh><blink>Web Ping</blink></font></center>";
{
$domainbase1 = array("www.google.com", "www.yahoo.com", "www.detik.com","www.blogger.com","www.okezone.com","www.domainmati.com","192.168.10.1");
while (list(, $host) = each ($domainbase1))
echo "<center><TABLE width=40% border=1><tr><td bgcolor=#0f00ff><font size=4pt color=#faff10><u>host: $host</u></font></td></tr></table></center>";
}
{
$domainbase = (isset($_POST['domainname'])) ? $_POST['domainname'] : '';
$domainbase = str_replace("http://","",strtolower($domainbase));
echo "<center><TABLE height=20% border=1>";
}
foreach ($domainbase1 as $value) {
$status = PING($value);
if ($status != -1) echo "<tr><td bgcolor=#fa00af><font color=#00ffff> Status Domain : http:// $value is REPLY ($status ms) </td><td>$on</td><tr>";
else echo "<tr><td bgcolor=#000000><font color=#ff0000>Status Domain : http:// $value is TIME OUT </td><td>$off</td><tr>";
}
echo "</table></center>"
?>
<?php
$site="http://localhost/ping.php";
header("Refresh: 9; url=$site");
?>
<center><marquee behavior="alternate" width="40%" bgcolor=#000000><font color=#5500fa>Di Buat Oleh : </font><font color="#fafa00"><i>Fajar M dan Lilik S</i></font></marquee></center>
<?php
echo "<center>$date</center>";
?>
<center>
<?php
$nextWeek = time() + (7 * 24 * 60 * 60);
// 7 days; 24 hours; 60 mins; 60secs
echo 'Tanggal: '. date('d-m-Y') ."\n";
?>
</center>
</body>
</html>