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

Source for file passreset.php

Documentation is available at passreset.php

  1. <?php
  2. /**
  3.  * User password reset page.
  4.  * This file displays the form used to reset the user password and sends the
  5.  * user the newly generated random password.
  6.  * @package HRDIODB
  7.  */
  8.  
  9. /**
  10.  * This file is part of HRDIODB.
  11.  *
  12.  * HRDIODB is free software; you can redistribute it and/or modify
  13.  * it under the terms of the GNU General Public License as published by
  14.  * the Free Software Foundation; either version 2 of the License, or
  15.  * (at your option) any later version.
  16.  *
  17.  * HRDIODB is distributed in the hope that it will be useful,
  18.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20.  * GNU General Public License for more details.
  21.  *
  22.  * You should have received a copy of the GNU General Public License
  23.  * along with HRDIODB; if not, write to the Free Software
  24.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25.  */
  26.  
  27. /** Configuration file */
  28. require_once("conf.php");
  29. /** HRDI database file */
  30. require_once("hrdi_db_class.php");
  31. /** PHP session class */
  32. require_once("session_class.php");
  33. /** User class */
  34. require_once("user_class.php");
  35. /** Common class */
  36. require_once("common_class.php");
  37. /** Debuggin functions */
  38. require_once("debugging.php");
  39.  
  40. // Create class instances
  41. $session new session();
  42. $hdb new hrdi_db ($dsn);
  43. $user new user ($hdb$session);
  44.  
  45. // Make sure we're NOT authenticated
  46. if ($user->authenticated()) {
  47.   // If we are, lets go back to where we were
  48.     $session->go_to_last_page();
  49. }
  50.  
  51. // Process the password reset request
  52. if (isset($_POST['reset'])) {
  53.   unset($_POST['reset']);
  54.  
  55.   // Execute the password reset. If all goes well, display the message.
  56.     if ($user->reset_password($_POST)) {
  57.     require_once("header.php");
  58.     print "<br/><center><div id=\"message_block\">Your password has been reset.
  59.           An e-mail has been sent to you with the new, randomly generated password.
  60.           When you get the e-mail, you can log in with the specified password
  61.           and change your password to a new one.</div></center>";
  62.     require_once("footer.php");
  63.     exit(1);
  64.   }
  65. }
  66.  
  67. // Page title
  68. $page_title "";
  69.  
  70. // Include the page header
  71. require_once("header.php");
  72.  
  73. // Display any errors
  74. if ($user->error{
  75.   error($user->error);
  76. }
  77.  
  78. // Display the password reset form
  79. ?>
  80. <center>
  81. <div id="message_block">When you reset your password, a random password will be
  82. sent to the e-mail you entered above. If you don't get the e-mail, please
  83. contact <a href="mailto:<?php print $hrdi_admin?>"><?php print
  84. $hrdi_admin?></a>.</div>
  85. <br/>
  86. <table class="user">
  87. <form name="pass_reset" method="post" action="<?php print $_SERVER['PHP_SELF']?>">
  88.   <tr>
  89.     <td colspan="2" align="center"><b>HRDI User Password Reset</b></td>
  90.   </tr>
  91.   <tr>
  92.     <td align="right">E-mail:</td>
  93.     <td>
  94.       <input type="text" name="Email" size="20" maxlength="255" value="<?php print common::get_value('Email'$_POST$user->data)?>">
  95.     </td>
  96.   </tr>
  97.   <tr>
  98.     <td colspan="2" align="right"><input type="submit" name="reset" value="Reset Password"></td>
  99.   </tr>
  100. </form>
  101. </table>
  102. </center>
  103. <script type="text/javascript">
  104. <?php // Grab the focus and put it in the Email field ?>
  105. document.pass_reset.Email.focus();
  106. </script>
  107. <?php
  108. // Include the page footer
  109. require_once("footer.php");
  110. ?>

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