IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 3, 2007, 10:24:09 AM (19 years ago)
Author:
eugene
Message:

better links

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippMonitor/raw/ipp.php

    r13566 r13595  
    99}
    1010
    11 function loginform () {
     11function loginform ($username) {
    1212  echo '<form action="Login.php" method="POST">', "\n";
    13   echo 'Username: <input type="text" name="username"><br>', "\n";
     13  if ($username) {
     14    echo "Username: <input type=\"text\" name=\"username\" value=\"$username\"><br>\n";
     15  } else {
     16    echo "Username: <input type=\"text\" name=\"username\"><br>\n";
     17  }
    1418  echo 'Password: <input type="text" name="password"><br>', "\n";
    1519  echo '<input type="submit" name="login" value="login">', "\n";
     
    1923function projectform ($ID) {
    2024    menu ('ipp.menu.dat', 'Select Project', 'ipp.css', $ID['link'], $ID['proj']);
     25    if ($_GET['new'] && $_GET['proj']) {
     26      echo "<p> Project is now <b>" . $_GET['proj'] . "</b></p>\n";
     27    }
    2128    echo "<p> Please select the project of interest </p>\n";
    22     echo "<form action=\"SelectProject.php\" method=\"POST\">\n";
    23     echo "Project: <input type=\"text\" name=\"proj\"><br>\n";
    24     echo "<input type=\"submit\" name=\"project\">\n";
     29    // echo "<form action=\"SelectProject.php\" method=\"POST\">\n";
     30    // echo "Project: <input type=\"text\" name=\"proj\"><br>\n";
     31    // echo "<input type=\"submit\" name=\"project\">\n";
    2532
    2633    $pass = $ID['pass'];
    27     echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
    28     echo "</form>\n";
     34    // echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">\n";
     35    // echo "</form>\n";
    2936
    3037    $db = dbconnect('ippadmin');
     
    4249    echo "<tr class=select><th class=select> projects </th></tr>\n";
    4350    while ($qry->fetchInto($row)) {
    44       echo "<tr class=select><td class=select> $row[0] </td></tr>\n";
     51      // add a link here to set the database
     52      $tmp_proj = $row[0];
     53      $tmp_link = "pass=$pass";
     54      echo "<tr class=select><td class=select><a href=\"SelectProject.php?$tmp_link&proj=$tmp_proj&new=1\"> $row[0] </a></td></tr>\n";
     55      // echo "<tr class=select><td class=select> $row[0] </td></tr>\n";
    4556    }
    4657    echo "</table>\n";
     
    7788  $password = $_POST[password];
    7889
     90  // if password is not specified, keep username and ask again
     91  if ($password == "") {
     92    menu ('ipp.menu.dat', 'Login', 'ipp.css', '', '');
     93    loginform ($username);
     94    menu_end ();
     95  }
     96
    7997  $db = dbconnect('ippadmin');
    8098
     
    84102  $qry = $db->query($sql);
    85103  if (DB::iserror($db)) {
     104    menu ('ipp.menu.dat', 'Login', 'ipp.css', '', '');
    86105    echo "<b>error reading users table</b><br>\n";
    87106    echo "Login Failed, please try again<br>\n";
    88     loginform ();
     107    loginform ("");
    89108    menu_end();
    90109  }
     
    94113    menu ('ipp.menu.dat', 'Login', 'ipp.css', '', '');
    95114    echo "Login Failed, please try again<br>\n";
    96     loginform ();
     115    loginform ("");
    97116    menu_end ();
    98117    exit ();
     
    179198    menu('ipp.menu.dat', 'Login', 'ipp.css', '', '');
    180199    logintext ();   
    181     loginform ();
     200    loginform ("");
    182201    menu_end ();
    183202  }
     
    185204  $db = dbconnect ('ippadmin');
    186205
    187   // make this a DB lookup
    188206  $pass = $ID['pass'];
     207
     208  // search for password
    189209  $sql = "SELECT username FROM cookies WHERE cookie = '$pass'";
    190210  $qry = $db->query($sql);
     
    192212    echo "<b>error reading users table</b><br>\n";
    193213    echo "Login Failed, please try again<br>\n";
    194     loginform ();
     214    loginform ("");
    195215    menu_end();
    196216  }
    197217 
    198   # $success = (($username == "eugene") && ($password == "test"));
    199218  $success = $qry->fetchInto($row);
    200219  if (! $success) {
    201220    menu('ipp.menu.dat', 'Login', 'ipp.css', '', '');
    202221    echo "unknown user, please login again<br>\n";
    203     loginform ();
     222    loginform ("");
    204223    menu_end ();
    205224  }
Note: See TracChangeset for help on using the changeset viewer.