Index: trunk/ippMonitor/def/autocode.php
===================================================================
--- trunk/ippMonitor/def/autocode.php	(revision 9012)
+++ trunk/ippMonitor/def/autocode.php	(revision 9016)
@@ -4,4 +4,9 @@
 
 $ID = checkID ();
+if ($ID['proj']) {
+  $db = dbconnect($ID['proj']);
+} else {
+  $db = dbconnect('detrend');
+}
 
 if ($ID['menu']) {
@@ -14,6 +19,4 @@
 
 echo "<p> $TITLE </p>";
-
-$db = dbconnect();
 
 // define restrictiosn to the queries
Index: trunk/ippMonitor/def/detInputExp.d
===================================================================
--- trunk/ippMonitor/def/detInputExp.d	(revision 9012)
+++ trunk/ippMonitor/def/detInputExp.d	(revision 9016)
@@ -4,7 +4,5 @@
 MENU  ipp.detrend.dat
 
-HEAD HTML  test head 1 <br>
-HEAD HTML  test head 2 <br>
-HEAD HTML  test head 3 <br>
+# HEAD HTML  test head 1 <br>
 
 #     field      width 	name        show  link to                 extras
@@ -15,5 +13,3 @@
 FIELD include,   7,   	include
 
-TAIL HTML test tail 1 <br>
-TAIL HTML test tail 2 <br>
-TAIL HTML test tail 3 <br>
+# TAIL HTML  test tail 1 <br>
Index: trunk/ippMonitor/raw/SelectProject.php
===================================================================
--- trunk/ippMonitor/raw/SelectProject.php	(revision 9012)
+++ trunk/ippMonitor/raw/SelectProject.php	(revision 9016)
@@ -3,12 +3,22 @@
 include 'ipp.php';
 
-checkID ();
+if (($_SERVER[REQUEST_METHOD] != 'POST') && ($_SERVER[REQUEST_METHOD] != 'GET')) {
+  menu ('ipp.menu.dat', 'Select Project', 'ipp.css', '');
+  echo "Invalid Client Request<br>\n";
+  menu_end ();
+  exit ();
+}
+
+$ID = checkID ();
 
 if ($_SERVER[REQUEST_METHOD] == 'GET') { 
-    menu ('ipp.menu.dat', 'Project', 'ipp.css', '');
+    menu ('ipp.menu.dat', 'Select Project', 'ipp.css', '');
     echo "<p> Select the project of interest </p>\n";
     echo "<form action=\"$myPage\" method=\"POST\">\n";
     echo "Project: <input type=\"text\" name=\"proj\"><br>\n";
     echo "<input type=\"submit\" name=\"project\">\n";
+
+    $pass = $ID['pass'];
+    echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
     echo "</form>\n";
 
@@ -16,25 +26,28 @@
 }
 
-if ($_SERVER[REQUEST_METHOD] != 'POST') { 
-  menu ('ipp.menu.dat', 'Project', 'ipp.css', '');
-  echo "Invalid Client Request<br>\n";
-  menu_end ();
+if ($_SERVER[REQUEST_METHOD] == 'POST') { 
+
+  if (key_exists (project, $_POST)) {
+    $myProj = $_POST[proj];
+    $ID['proj'] = $myProj;
+    // validate the existence of the project
+
+    // update ID['link']
+    // $link is attached to every nav link
+    $ID['link'] = "pass=" . $ID['pass'];
+    if ($ID['proj']) {
+      $ID['link'] = $ID['link'] . "&proj=" . $ID['proj'];
+    }
+
+    menu ('ipp.menu.dat', 'Select Project', 'ipp.css', $ID['link']);
+    echo "New project is : $myProj<br>\n";
+
+    echo "ID list<br>\n";
+    foreach ($ID as $key => $value) {
+      echo "$key : $value<br>\n";
+    }
+
+    menu_end();
+  }
 }
-
-if (key_exists (project, $_POST)) {
-  $myProj = $_POST[proj];
-  # validate the existence of the project
-  $_GET[proj] = $myProj;
-  menu ('ipp.menu.dat', 'Project', 'ipp.css', '');
-  echo "New project is : $myProj\n";
-  menu_end();
-}
-  
-menu ('ipp.menu.dat', 'Project', 'ipp.css', '');
-echo "Invalid Client Post Request<br>\n";
-foreach ($_POST as $key => $value) {
-  echo "$key : $value<br>\n";
-}
-menu_end ();
-
 ?>
Index: trunk/ippMonitor/raw/ipp.detrend.dat
===================================================================
--- trunk/ippMonitor/raw/ipp.detrend.dat	(revision 9012)
+++ trunk/ippMonitor/raw/ipp.detrend.dat	(revision 9016)
@@ -24,5 +24,7 @@
 menutop   | menutop      | plain   | &nbsp;                       | 
 menulink  | menuselect 	 | link    | Master Detrend Frames        | masterDetrendFrames.php
+menulink  | menuselect 	 | link    | Master Detrend Imfiles       | masterDetrendImfiles.php
 menulink  | menuselect 	 | link    | Detrend Runs                 | detRunSummary.php             
+menulink  | menuselect 	 | link    | Raw Detrend Exp              | rawDetrendExp.php
 menulink  | menuselect 	 | link    | Input Detrend Exp            | detInputExp.php                    
 menulink  | menuselect 	 | link    | Resid Detrend Exp            | detResidExp.php                       
Index: trunk/ippMonitor/raw/ipp.php
===================================================================
--- trunk/ippMonitor/raw/ipp.php	(revision 9012)
+++ trunk/ippMonitor/raw/ipp.php	(revision 9016)
@@ -15,10 +15,9 @@
 }
 
-function dbconnect () {
+function dbconnect ($database) {
 
   // connect to the database
   require_once('DB.php');
-  // $db = DB::connect("mysql://ipp:ipp@localhost/ipp");
-  $db = DB::connect("mysql://ipp:ipp@localhost/detrend");
+  $db = DB::connect("mysql://ipp:ipp@alala/$database");
   if (DB::iserror($db)) {
     echo "<b>error accessing database</b><br>\n";
@@ -40,7 +39,18 @@
   $password = $_POST[password];
 
+  $db = dbconnect('ippadmin');
+
   // make this a DB lookup
-  $success = (($username == "eugene") && ($password == "test"));
-
+  $sql = "SELECT username FROM users WHERE username = '$username' AND password = '$password'";
+
+  $qry = $db->query($sql);
+  if (DB::iserror($db)) {
+    echo "<b>error reading users table</b><br>\n";
+    echo "Login Failed, please try again<br>\n";
+    loginform ();
+    menu_end();
+  }
+  
+  $success = $qry->fetchInto($row);
   if (!$success) {  
     menu ('ipp.menu.dat', 'Login', 'ipp.css', '');
@@ -53,6 +63,26 @@
   // generate an random ephemeral ID
   $ID['name'] = $username;
-  $ID['pass'] = "foobar";
   $ID['proj'] = "";
+
+  // generate a cookie for the user
+  $sql = "SELECT username,cookie FROM cookies WHERE username = '$username'";
+  $qry = $db->query($sql);
+  if (DB::iserror($db)) {
+    echo "Cookie Failed, please try again<br>\n";
+    menu_end();
+  }
+
+  if ($qry->fetchInto($row)) {
+    $ID['pass'] = $row[1];
+  } else {
+    $cookie = rand(0,100000);
+    $ID['pass'] = $cookie;
+    $sql = "INSERT into cookies (username, cookie) values ('$username', '$cookie')";
+    $qry = $db->query($sql);
+    if (DB::iserror($db)) {
+      echo "Cookie Failed, please try again<br>\n";
+      menu_end();
+    }
+  }
 
   // the link is attached to every nav link
@@ -107,6 +137,20 @@
   }
 
-  // user supplied an invalid pass
-  if ($ID['pass'] != "foobar") {
+  $db = dbconnect ('ippadmin');
+
+  // make this a DB lookup
+  $pass = $ID['pass'];
+  $sql = "SELECT username FROM cookies WHERE cookie = '$pass'";
+  $qry = $db->query($sql);
+  if (DB::iserror($db)) {
+    echo "<b>error reading users table</b><br>\n";
+    echo "Login Failed, please try again<br>\n";
+    loginform ();
+    menu_end();
+  }
+  
+  # $success = (($username == "eugene") && ($password == "test"));
+  $success = $qry->fetchInto($row);
+  if (! $success) {
     menu('ipp.menu.dat', 'Login', 'ipp.css', '');
     echo "unknown user, please login again<br>\n";
@@ -114,14 +158,13 @@
     menu_end ();
   }
-
   // use the pass value to find the corresponding user
-  $ID['name'] = "eugene";
+  $ID['name'] = $row[0];
 
   // $link is attached to every nav link
   $ID['link'] = "pass=" . $ID['pass'];
   if ($ID['proj']) {
-    $ID['link'] = $link . "&proj=" . $ID['proj'];
-  }
-
+    $ID['link'] = $ID['link'] . "&proj=" . $ID['proj'];
+  }
+  
   return $ID;
 }
