Location: PHPKode > projects > ARTIS WaterMon > artis-watermon-beta/main.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>ARTIS Water Monitor</title>
	<meta HTTP-EQUIV="Refresh" content="120;url=main.php">
	<link rel="stylesheet" type="text/css" href="main.css">
	<script type="text/javascript" language="JavaScript">
	<!--
		function jump(fe){
		opt_key = fe.selectedIndex;
		var uri_val = fe.options[opt_key].value;
		window.open(uri_val,'_self');
		return true;
 	}
 	//-->
	</script>
</head>

<body>
<?php
	function drawUserListJumpSelectBox() {
		global $dbuser,$dbpassword,$dbname,$owner;
		mysql_connect('localhost', $dbuser, $dbpassword) or die("<p>MySQL Connect failed: ".mysql_error()."</p>");
		mysql_select_db($dbname) or die("<p>MySql Select DB failed: ".mysql_error()."</p>");
		$query = "SELECT * FROM users";
		$result = mysql_query($query) or die("<p>Query Failed: " .mysql_error()."</p><p><pre>$query</pre></p>");
		echo "<select name='user' id='user' onchange='return jump(this)'>";
		if(mysql_num_rows($result) > 0) {
			echo "<option value='main.php'>Select Page</option>";
			while($row = mysql_fetch_array($result)) {
				echo "<option value='main.php?owner=" . $row['id'] . "'>" . $row['friendly_name'];
				if($owner == $row['id']) { echo "*"; }
				echo "</option>";
			}
		}
		echo "</select>";		
	}
	
require "functions.php";	// Requires all that we need!
if(isset($_REQUEST['owner'])) {
	$owner = $_REQUEST['owner'];
} else {
	$owner = 1;
}
drawUserListJumpSelectBox();

$metadata = loadMetaData();
printDateTime($metadata);
$data = loadCSV();
$pumps = Array();		// Define pumps array; holds all of our pumps
$reservoirs = Array(); 	// Define reservoirs array; holds all of our reservoirs
$flowmeters = Array(); 	// Define flow meter array; holds all of our flow meters
$raingauges = Array(); 	// Define rain gauge array; holds all of our rain gauges
$lines = Array();		// Define lines array; holds all of the lines!
$database = mysql_connect('localhost',$dbuser,$dbpassword) or die ("Couldn't connect to database: " . mysql_error());
mysql_select_db($dbname,$database) or die ("Couldn't select database: " . mysql_error());

//	die("<p>Ther OWNER!!!!!: {$owner}</p>");
configurePumps($pumps,$owner);
configureReservoirs($reservoirs,$owner);
configureFlowMeters($flowmeters,$owner);
configureRainGauges($raingauges,$owner);
configureLines($lines,$owner);
/*$pumps['C1PS1'] = new pump(138, "C1PS1", 150, 75, $data);
$pumps['C1PS2'] = new pump(139, "C1PS2", 150, 180, $data);
//$pumps['C2PS3'] = new pump(140, "Hello", 500, 200, $data);
$reservoirs['Pechey'] = new reservoir(94, "Pechey", 740,70, $data);
$reservoirs['Jockey'] = new reservoir(61, "Jockey", 340,70, $data);
$flowmeters['C1PS_Flow'] = new flowmeter(284, "C1PS Flow", 255,155, $data);*/
//echo "Checking Pumps...";
foreach($pumps as $pump) {
	echo $pump->getHTML();
}
//echo "Complete!<br>";
//echo "Checking Reservoirs...";
foreach($reservoirs as $reservoir) {
	echo $reservoir->getHTML();
}
//echo "Complete!<br>";
//echo "Checking Flow Meters...";
foreach($flowmeters as $meter) {
	echo $meter->getHTML();
}
//echo "Complete!<br>";
//echo "Checking Rain Gauges...";
foreach($raingauges as $gauge) {
	echo $gauge->getHTML();
}
//echo "Complete!<br>";
//echo "Checking Lines...";
foreach($lines as $line) {
	echo $line->getHTML();
}
//echo "Complete!";
echo "<br><br>";
mysql_close($database);
?>
</body>
</html>
Return current item: ARTIS WaterMon