HRDIODB
[ class tree: HRDIODB ] [ index: HRDIODB ] [ all elements ]

Source for file login.php

Documentation is available at login.php

  1. <?php
  2. /**
  3.  * HRDI user login.
  4.  * This file displays the login form for HRDI users.
  5.  * @package HRDIODB
  6.  */
  7.  
  8. /**
  9.  * This file is part of HRDIODB.
  10.  *
  11.  * HRDIODB is free software; you can redistribute it and/or modify
  12.  * it under the terms of the GNU General Public License as published by
  13.  * the Free Software Foundation; either version 2 of the License, or
  14.  * (at your option) any later version.
  15.  *
  16.  * HRDIODB is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.  * GNU General Public License for more details.
  20.  *
  21.  * You should have received a copy of the GNU General Public License
  22.  * along with HRDIODB; if not, write to the Free Software
  23.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  24.  */
  25.  
  26. /** Configuration file */
  27. require_once("conf.php");
  28. /** HRDI database class */
  29. require_once("hrdi_db_class.php");
  30. /** PHP session class */
  31. require_once("session_class.php");
  32. /** User class */
  33. require_once("user_class.php");
  34. /** Common class */
  35. require_once("common_class.php");
  36. /** Debugging functions */
  37. require_once("debugging.php");
  38.  
  39. // Create class instances
  40. $session new session();
  41. $hdb new hrdi_db ($dsn);
  42. $user new user ($hdb$session);
  43.  
  44. // If we're already authenticated, go back to where we were
  45. if ($user->authenticated()) {
  46.   $session->go_to_last_page();
  47. }
  48.  
  49. // Perform the login procedure
  50. if (isset($_POST['login'])) {
  51.   if ($user->authenticate($_POST['email']$_POST['password'])) {
  52.     // We're successfully authenticated. Magically go back to where we were.
  53.         $session->go_to_last_page();
  54.   }
  55. }
  56.  
  57. // Page title
  58. $page_title "";
  59.  
  60. // Include the page header
  61. require_once("header.php");
  62.  
  63. // Print out any errors
  64. if ($user->error{
  65.   error($user->error);
  66. }
  67.  
  68. // Print out the login form
  69. ?>
  70. <br/><br/>
  71. <center>
  72. <table class="login">
  73. <form name="login_form" method="post" action="<?php print $_SERVER['PHP_SELF']?>">
  74.   <tr>
  75.     <td colspan="2" align="center"><b>HRDI User Login</b></td>
  76.   </tr>
  77.   <tr>
  78.     <td align="right">E-mail:</td>
  79.     <td><input type="text" name="email" size="20" maxlength="255" value="<?php print common::get_value('email'$_POST)?>"></td>
  80.   </tr>
  81.   <tr>
  82.     <td align="right">Password:</td>
  83.     <td><input type="password" name="password" size="20"></td>
  84.   </tr>
  85.   <tr>
  86.     <td colspan="2" align="right"><input type="submit" name="login" value="Login"></td>
  87.   </tr>
  88. </form>
  89. </table>
  90. <br/>
  91. <table class="main">
  92.   <tr>
  93.     <td colspan="2">
  94.       <ul>
  95.         <li><a href="passreset.php">I forgot my password</a></li>
  96.         <li><a href="user.php?mode=register">Register</a></li>
  97.       </ul>
  98.     </td>
  99.   </tr>
  100. </table>
  101. </center>
  102. <script type="text/javascript">
  103. <!--
  104. <?php // Grab the focus and smack it in the e-mail input box ?>
  105. document.login_form.email.focus();
  106. //-->
  107. </script>
  108. <?php
  109. // Include the page footer
  110. require_once("footer.php");
  111. ?>

Documentation generated on Tue, 23 Jan 2007 22:57:49 -0500 by phpDocumentor 1.3.0RC6