| Current File : //var/wcp4/whoeathk/public_html/scripts/scripts/scripts/scripts/scripts/bandwidthmeter/results.php |
<!-- Copyright 2002 (C) Gambit Design Internet Services -->
<!-- This is licensed under the GNU Public License -->
<!-- Author: Derek T Del Conte - derek@gambitdesign.com -->
<?php include_once("config.inc.php"); ?>
<html>
<head>
<title>Bandwidth Meter</title>
<link rel="stylesheet" href="style.css">
</head>
<body
bgcolor="#FFFFFF" leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0">
<?php
$kbps = round($_GET['kbps'], 2);
$ksec = round($kbps / 8, 2);
$mbps = round($kbps / 1024, 2);
$msec = round($mbps / 8, 2);
?>
<center>
<font size=+1>Your current bandwidth reading is:</font><br>
<font size=+2 color=red>
<?php
if ($mbps > 1) {
printf ("%.2f",$mbps);
echo " Mbps<br>";
} else {
printf ("%.2f",$kbps);
echo "kbps<br>";
}
?>
</font>
<?php
if ($msec > 1) {
echo "<font face=\"Verdana,Arial,Helvetica\" size=\"-2\">which means you can download at " . $msec . " MB/sec. from our servers.</font>";
} else {
echo "<font face=\"Verdana,Arial,Helvetica\" size=\"-2\">which means you can download at " . $ksec . " KB/sec. from our servers.</font>";
}
?>
<br>
<table bgcolor=#000000 cellspacing=0 cellpadding=1 border=0><tr><td>
<table bgcolor=#E6E6E6 cellspacing=5 cellpadding=0 border=0>
<?php
$service_speeds = array();
foreach(array_keys($services) as $service) {
array_push ($service_speeds, $service);
}
$max_in_array = max ($service_speeds);
if ($kbps > $max_in_array) {
$bar_scale = 400/$kbps;
} else {
$bar_scale = 0.267;
}
foreach(array_keys($services) as $service) {
if (($service > $kbps) && $you_out == False) {
$bar_size = $kbps * $bar_scale;
$you_bar_height = $bar_height + 5;
echo "<tr>\n";
echo "<td align=left class=font><b>$kbps kbps</b></td>\n";
echo "<td align=center class=font><b>YOU</b></td>\n";
echo "<td align=left><img src=images/$user_graph_image
height=$you_bar_height width=$bar_size></td>";
echo "</tr>\n";
$you_out = True;
}
$name = $services[$service]["name"];
$image = $services[$service]["image"];
$bar_size = $service * $bar_scale;
echo "<tr>\n";
echo "<td align=left class=font>$service kbps</td>\n";
echo "<td align=center class=font>$name</td>\n";
echo "<td align=left><img src=images/$image height=$bar_height
width=$bar_size></td>";
echo "</tr>\n";
}
if ($you_out == False) {
$bar_size = $kbps * $bar_scale;
$you_bar_height = $bar_height + 5;
echo "<tr>\n";
echo "<td align=left class=font><b>$kbps kbps</b></td>\n";
echo "<td align=center class=font><b>YOU</b></td>\n";
echo "<td align=left><img src=images/$user_graph_image
height=$you_bar_height width=$bar_size></td>";
echo "</tr>\n";
}
?>
</table>
</table>
<font size=+0>
<?php
if ($use_initialmeter == True) {
$link_file = "./initialmeter.php";
} else {
$link_file = "./meter.php";
}
?>
<br>
<div class=font><b>
<a href="<?php echo $link_file; ?>">Retest</a> <a href="javascript:window.close()">Close</a></font>
</b></div>
</body>
</html>
<?php
if ($mysql == True) {
$link = mysql_connect($database["host"], $database["login"],
$database["password"])
or die("Could not connect");
mysql_select_db($database["database"])
or die("Could not select database");
$ip = $_SERVER['REMOTE_ADDR'];
$name = gethostbyaddr($ip);
$query = "INSERT INTO readings (speed, ip, name) VALUES ($kbps, '$REMOTE_ADDR', '$name')";
$result = mysql_query($query)
or die("Query failed");
}
?>