Changeset 9016
- Timestamp:
- Sep 27, 2006, 4:57:39 PM (20 years ago)
- Location:
- trunk/ippMonitor
- Files:
-
- 5 edited
-
def/autocode.php (modified) (2 diffs)
-
def/detInputExp.d (modified) (2 diffs)
-
raw/SelectProject.php (modified) (2 diffs)
-
raw/ipp.detrend.dat (modified) (1 diff)
-
raw/ipp.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippMonitor/def/autocode.php
r9011 r9016 4 4 5 5 $ID = checkID (); 6 if ($ID['proj']) { 7 $db = dbconnect($ID['proj']); 8 } else { 9 $db = dbconnect('detrend'); 10 } 6 11 7 12 if ($ID['menu']) { … … 14 19 15 20 echo "<p> $TITLE </p>"; 16 17 $db = dbconnect();18 21 19 22 // define restrictiosn to the queries -
trunk/ippMonitor/def/detInputExp.d
r9011 r9016 4 4 MENU ipp.detrend.dat 5 5 6 HEAD HTML test head 1 <br> 7 HEAD HTML test head 2 <br> 8 HEAD HTML test head 3 <br> 6 # HEAD HTML test head 1 <br> 9 7 10 8 # field width name show link to extras … … 15 13 FIELD include, 7, include 16 14 17 TAIL HTML test tail 1 <br> 18 TAIL HTML test tail 2 <br> 19 TAIL HTML test tail 3 <br> 15 # TAIL HTML test tail 1 <br> -
trunk/ippMonitor/raw/SelectProject.php
r8984 r9016 3 3 include 'ipp.php'; 4 4 5 checkID (); 5 if (($_SERVER[REQUEST_METHOD] != 'POST') && ($_SERVER[REQUEST_METHOD] != 'GET')) { 6 menu ('ipp.menu.dat', 'Select Project', 'ipp.css', ''); 7 echo "Invalid Client Request<br>\n"; 8 menu_end (); 9 exit (); 10 } 11 12 $ID = checkID (); 6 13 7 14 if ($_SERVER[REQUEST_METHOD] == 'GET') { 8 menu ('ipp.menu.dat', ' Project', 'ipp.css', '');15 menu ('ipp.menu.dat', 'Select Project', 'ipp.css', ''); 9 16 echo "<p> Select the project of interest </p>\n"; 10 17 echo "<form action=\"$myPage\" method=\"POST\">\n"; 11 18 echo "Project: <input type=\"text\" name=\"proj\"><br>\n"; 12 19 echo "<input type=\"submit\" name=\"project\">\n"; 20 21 $pass = $ID['pass']; 22 echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n"; 13 23 echo "</form>\n"; 14 24 … … 16 26 } 17 27 18 if ($_SERVER[REQUEST_METHOD] != 'POST') { 19 menu ('ipp.menu.dat', 'Project', 'ipp.css', ''); 20 echo "Invalid Client Request<br>\n"; 21 menu_end (); 28 if ($_SERVER[REQUEST_METHOD] == 'POST') { 29 30 if (key_exists (project, $_POST)) { 31 $myProj = $_POST[proj]; 32 $ID['proj'] = $myProj; 33 // validate the existence of the project 34 35 // update ID['link'] 36 // $link is attached to every nav link 37 $ID['link'] = "pass=" . $ID['pass']; 38 if ($ID['proj']) { 39 $ID['link'] = $ID['link'] . "&proj=" . $ID['proj']; 40 } 41 42 menu ('ipp.menu.dat', 'Select Project', 'ipp.css', $ID['link']); 43 echo "New project is : $myProj<br>\n"; 44 45 echo "ID list<br>\n"; 46 foreach ($ID as $key => $value) { 47 echo "$key : $value<br>\n"; 48 } 49 50 menu_end(); 51 } 22 52 } 23 24 if (key_exists (project, $_POST)) {25 $myProj = $_POST[proj];26 # validate the existence of the project27 $_GET[proj] = $myProj;28 menu ('ipp.menu.dat', 'Project', 'ipp.css', '');29 echo "New project is : $myProj\n";30 menu_end();31 }32 33 menu ('ipp.menu.dat', 'Project', 'ipp.css', '');34 echo "Invalid Client Post Request<br>\n";35 foreach ($_POST as $key => $value) {36 echo "$key : $value<br>\n";37 }38 menu_end ();39 40 53 ?> -
trunk/ippMonitor/raw/ipp.detrend.dat
r9011 r9016 24 24 menutop | menutop | plain | | 25 25 menulink | menuselect | link | Master Detrend Frames | masterDetrendFrames.php 26 menulink | menuselect | link | Master Detrend Imfiles | masterDetrendImfiles.php 26 27 menulink | menuselect | link | Detrend Runs | detRunSummary.php 28 menulink | menuselect | link | Raw Detrend Exp | rawDetrendExp.php 27 29 menulink | menuselect | link | Input Detrend Exp | detInputExp.php 28 30 menulink | menuselect | link | Resid Detrend Exp | detResidExp.php -
trunk/ippMonitor/raw/ipp.php
r9009 r9016 15 15 } 16 16 17 function dbconnect ( ) {17 function dbconnect ($database) { 18 18 19 19 // connect to the database 20 20 require_once('DB.php'); 21 // $db = DB::connect("mysql://ipp:ipp@localhost/ipp"); 22 $db = DB::connect("mysql://ipp:ipp@localhost/detrend"); 21 $db = DB::connect("mysql://ipp:ipp@alala/$database"); 23 22 if (DB::iserror($db)) { 24 23 echo "<b>error accessing database</b><br>\n"; … … 40 39 $password = $_POST[password]; 41 40 41 $db = dbconnect('ippadmin'); 42 42 43 // make this a DB lookup 43 $success = (($username == "eugene") && ($password == "test")); 44 44 $sql = "SELECT username FROM users WHERE username = '$username' AND password = '$password'"; 45 46 $qry = $db->query($sql); 47 if (DB::iserror($db)) { 48 echo "<b>error reading users table</b><br>\n"; 49 echo "Login Failed, please try again<br>\n"; 50 loginform (); 51 menu_end(); 52 } 53 54 $success = $qry->fetchInto($row); 45 55 if (!$success) { 46 56 menu ('ipp.menu.dat', 'Login', 'ipp.css', ''); … … 53 63 // generate an random ephemeral ID 54 64 $ID['name'] = $username; 55 $ID['pass'] = "foobar";56 65 $ID['proj'] = ""; 66 67 // generate a cookie for the user 68 $sql = "SELECT username,cookie FROM cookies WHERE username = '$username'"; 69 $qry = $db->query($sql); 70 if (DB::iserror($db)) { 71 echo "Cookie Failed, please try again<br>\n"; 72 menu_end(); 73 } 74 75 if ($qry->fetchInto($row)) { 76 $ID['pass'] = $row[1]; 77 } else { 78 $cookie = rand(0,100000); 79 $ID['pass'] = $cookie; 80 $sql = "INSERT into cookies (username, cookie) values ('$username', '$cookie')"; 81 $qry = $db->query($sql); 82 if (DB::iserror($db)) { 83 echo "Cookie Failed, please try again<br>\n"; 84 menu_end(); 85 } 86 } 57 87 58 88 // the link is attached to every nav link … … 107 137 } 108 138 109 // user supplied an invalid pass 110 if ($ID['pass'] != "foobar") { 139 $db = dbconnect ('ippadmin'); 140 141 // make this a DB lookup 142 $pass = $ID['pass']; 143 $sql = "SELECT username FROM cookies WHERE cookie = '$pass'"; 144 $qry = $db->query($sql); 145 if (DB::iserror($db)) { 146 echo "<b>error reading users table</b><br>\n"; 147 echo "Login Failed, please try again<br>\n"; 148 loginform (); 149 menu_end(); 150 } 151 152 # $success = (($username == "eugene") && ($password == "test")); 153 $success = $qry->fetchInto($row); 154 if (! $success) { 111 155 menu('ipp.menu.dat', 'Login', 'ipp.css', ''); 112 156 echo "unknown user, please login again<br>\n"; … … 114 158 menu_end (); 115 159 } 116 117 160 // use the pass value to find the corresponding user 118 $ID['name'] = "eugene";161 $ID['name'] = $row[0]; 119 162 120 163 // $link is attached to every nav link 121 164 $ID['link'] = "pass=" . $ID['pass']; 122 165 if ($ID['proj']) { 123 $ID['link'] = $ link. "&proj=" . $ID['proj'];124 } 125 166 $ID['link'] = $ID['link'] . "&proj=" . $ID['proj']; 167 } 168 126 169 return $ID; 127 170 }
Note:
See TracChangeset
for help on using the changeset viewer.
