Current File : //var/wcp4/wongwais/public_html/scripts/scripts/scripts/bandwidthmeter/admin/view_by_ip.php
<!-- Copyright 2002 (C) Gambit Design Internet Services -->
<!-- This is licensed under the GNU Public License -->
<!-- Author: Derek T Del Conte - derek@gambitdesign.com -->
<?
ini_set('include_path' , '/home/thischr/public_html/scripts/bandwidthmeter/');      
include_once("config.inc.php");
?>

<html>
<head>
	<title><?php echo $isp_name; ?> - Bandwidth Meter - View by IP</title>
	<link rel="stylesheet" href="../style.css">
</head>

<body bgcolor="#FFFFFF">

	<h2>BandwidthMeter</h2>
	<h3>View by IP</h3>

	<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method=POST>

	<select name=lookup>
	<option>
	
	<?php
		$lookup = $_POST['lookup'];
		$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");

		$query = "SELECT DISTINCT ip FROM readings";
		$result = mysql_query($query)
   			or die("Query failed");
		while ($ip = mysql_fetch_array($result, MYSQL_ASSOC)) {
			$ips[] = $ip["ip"];
		}
		sort($ips, SORT_NUMERIC);
		foreach($ips as $ip) {
			echo "<option";
			if ($lookup == $ip) {
				echo " selected";
			}
			echo ">";
			echo $ip;
			echo "\n";
		}
	?>
	
	</select>

	<input type=submit>

	<br><br><br>

	<br><br>

	<?php
		if (isset($lookup)) {
			echo "<b>Speeds for $lookup</b><br><br>\n";

			$query = "SELECT UNIX_TIMESTAMP(date), speed FROM readings WHERE ip='$lookup'";
			$result = mysql_query($query)
   				or die("Query failed");
			echo "<table cellpadding=5 cellspacing=0 border=0>\n";
			echo "<tr><td><b>Date</b></td><td><b>Speed</b></td><tr>\n";
			while ($data = mysql_fetch_array($result, MYSQL_ASSOC)) {
				$newdate = date("F jS, Y  g:ia", $data["UNIX_TIMESTAMP(date)"]);

				echo "<tr><td>$newdate</td>";
				echo "<td>" . $data["speed"] . " kbps</td></tr>";
			}
			echo "</table>";
		}
	?>

</form>
</body>
</html>

<?php




?>