1 <% include('/elements/header-popup.html', "Ping $ip" ) %>
3 <% include('/elements/xmlhttp.html',
4 'url' => $p. 'misc/xmlhttp-ping.html',
9 %# <img src="<%$p%>images/bullet_red.png" border=0>
12 <%ntable("#cccccc", 2)%>
16 <TD BGCOLOR="#ffffff" ID="ping_status">Checking...</TD>
20 <TD BGCOLOR="#ffffff" ID="ping_packetloss"></TD>
24 <TD BGCOLOR="#ffffff" ID="ping_latency"></TD>
28 <TD BGCOLOR="#ffffff" ID="ping_packets"></TD>
35 <INPUT TYPE="button" VALUE="Close" onClick="parent.nd(1);">
38 <SCRIPT TYPE="text/javascript">
45 function ping_update ( updatetext ) {
46 var pingArray = eval('(' + updatetext + ')');
47 var status = pingArray[0];
48 var rtt = pingArray[1];
52 } else if ( status == 1 ) {
54 totaltime = totaltime + rtt;
55 avg = totaltime / pongs;
58 var loss = 100 * fails / ( fails + pongs );
60 var statusCell = document.getElementById('ping_status');
61 var packetlossCell = document.getElementById('ping_packetloss');
62 var latencyCell = document.getElementById('ping_latency');
63 var packetsCell = document.getElementById('ping_packets');
68 status = '<FONT COLOR="#ff0000">Unreachable</FONT>';
72 status = '<FONT COLOR="#ff9900">High packet loss</FONT>';
75 status = '<FONT COLOR="#ff9900">High latency</FONT>';
77 status = '<FONT COLOR="#00cc00">Up</FONT>';
80 statusCell.innerHTML = '<B>' + status + '</B>';
81 packetlossCell.innerHTML = '<B>' + Math.round(loss) + '%</B>';
83 latencyCell.innerHTML = '<B>' + Math.round( avg*1000 ) + 'ms</B>';
85 var packets = fails + pongs;
86 packetsCell.innerHTML = '<B>' + packets + '</B>';
88 setTimeout( "ping('<%$ip%>', ping_update)", 1000 );
92 ping( '<%$ip%>', ping_update );
98 my($query) = $cgi->keywords;
99 $query =~ /^([\d\.]+)$/ or die 'Illegal IP';