Index: trunk/ippMonitor/raw/ipp.php
===================================================================
--- trunk/ippMonitor/raw/ipp.php	(revision 9003)
+++ trunk/ippMonitor/raw/ipp.php	(revision 9008)
@@ -19,5 +19,6 @@
   // connect to the database
   require_once('DB.php');
-  $db = DB::connect("mysql://ipp:ipp@localhost/ipp");
+#  $db = DB::connect("mysql://ipp:ipp@localhost/ipp");
+  $db = DB::connect("mysql://ipp:ipp@localhost/detrend");
   if (DB::iserror($db)) {
     echo "<b>error accessing database</b><br>\n";
@@ -176,4 +177,49 @@
 }
 
+function check_restrict ($key, $where) {
+  // echo "key: $key<br>\n";
+  if ($_SERVER[REQUEST_METHOD] == 'GET') { 
+    $value = $_GET[$key]; 
+    // echo "using GET<br>\n";
+  } else {
+    $value = $_POST[$key];
+    // echo "using POST<br>\n";
+  }
+  // echo "value: $value<br>\n";
+  if ($value) {
+    if ($where) {
+      $where = $where . " AND $key = '$value'";
+      // echo "where 1: $where<br>\n";
+    } else {
+      $where = "$key = '$value'";
+      // echo "where 2: $where<br>\n";
+    }
+  }
+  return $where;
+}
+
+function write_query_row ($key) {
+  $value = $_POST[$key];
+  if (($_SERVER[REQUEST_METHOD] == 'POST') && $value) { 
+    echo "<td class=\"list\"> <input type=\"text\" name=\"$key\" value=\"$value\"> </td>\n";
+  } else {
+    echo "<td class=\"list\"> <input type=\"text\" name=\"$key\"> </td>\n";
+  }
+}
+
+// expect image supplied with key=name
+function insert_image ($key) {
+
+  if ($_SERVER[REQUEST_METHOD] == 'GET') { 
+    $name = $_GET[$key]; 
+  } else {
+    $name = $_POST[$key]; 
+  }
+
+  if ($name) {
+    echo "<img src=\"$name\">\n";
+  }
+}
+
 // $myPage = $_SERVER[SCRIPT_NAME] . "?pass=$pass";
 
