Source for file change.php

Documentation is available at change.php

  1. <?php
  2. /**
  3. * Change password
  4. * <br/><br/>
  5. * Script for changing password
  6. * <br/><br/>
  7. * Access for all users
  8. @author Gabriele Droege, DNA Bank Network <contact@dnabank-network.org>
  9. @version 2.0
  10. @package Configuration
  11. @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org<br>The contents of this file are subject to the Mozilla Public License Version 1.1
  12. @filesource
  13. @license http://www.mozilla.org/MPL/ MPL
  14. */
  15.  
  16.     /**
  17.     * calling connection to database
  18.     */
  19.     include ("../config/head.php");
  20.  
  21.     /**
  22.     * calling authorisation script
  23.     */
  24.     include ("../auth.php");
  25. ?>
  26.  
  27.  
  28. <html>
  29.  
  30. <head>
  31. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  32. <title>DNA Module - Configuration tool</title>
  33. <link rel="stylesheet" type="text/css" href="../format.css">
  34. <link rel="stylesheet" type="text/css" href="../input/XSLT/Styles.css">
  35. <SCRIPT LANGUAGE="JavaScript1.1" src="../Functions.js"></SCRIPT>
  36. <NOSCRIPT>Please enable Javascript!</NOSCRIPT>
  37.  
  38.  
  39. <body>
  40. <div align="center">
  41.  
  42. <?php
  43.  
  44.     /**
  45.     * including navigation menu
  46.     */
  47.     include("../tablenavi.php")?>
  48.     
  49. <form name="formular" method="POST" action="change.php">
  50. <table id="tablemain" border="0"  class="main">
  51. <tr>
  52.   <td id="tdLogo"><img border="0" href="<?php echo $Path_Wiki?>" src="../images/Logo-DNA-Bank-Network-ocker.jpg" width="123" height="78"></td>
  53.         <td id="tdtitle">
  54.         <h1>Configuration Tool<br />Change Password</h1></td>
  55.     <td id="tdLogo2"><?php echo $Path_Logo?></td>
  56.     </tr>
  57.   <tr>
  58.   <td colspan="4"><?php
  59.     echo "Logged in as: ";
  60.     $log $_SESSION["log"];
  61.     echo $log;
  62.     ?></td></tr>
  63.     <tr>
  64.         <td colspan="3" valign="top">
  65.     <?php   
  66.     
  67.     /********************************************************************************************
  68.     * checking and saving new password                                                          *
  69.     * START                                                                                     *
  70.     *********************************************************************************************/
  71.     
  72.     if($formSubmitSave)   
  73.     {   
  74.     
  75.     if(empty($_POST['formPassOld']or empty($_POST['formPassNew']or empty($_POST['formPassNew2']))
  76.     echo '<table border="0" id="TableTextSmall2"><tr><td><span id="error">Please complete all fields!</span></td></tr></table>'
  77.     $test123 'true';}
  78.     
  79.  
  80.     if($_POST['formPassNew'!= "" and strlen($_POST['formPassNew']6
  81.       echo "<table border='0' id='TableTextSmall2'><tr><td><span id='error'>Your password is too short.</span></td></tr></table>"
  82.       $check "true";}
  83.     if ($_POST['formPassNew'!= "" and preg_match("/^[0-9]+$/"$_POST['formPassNew'])) {
  84.       echo "<table border='0' id='TableTextSmall2'><tr><td><span id='error'>Your password contains numbers only.</span></td></tr></table>";
  85.       $check "true"}
  86.     if ($_POST['formPassNew'!= "" and preg_match("/^[a-zA-Z]+$/"$_POST['formPassNew'])) {
  87.       echo "<table border='0' id='TableTextSmall2'><tr><td><span id='error'>Your password contents letters only.</span></td></tr></table>"
  88.       $check "true";}
  89.     if ($_POST['formPassNew'!= "" and preg_match('/[^a-zA-Z0-9-_.]/'$_POST['formPassNew'])) {
  90.       echo "<table border='0' id='TableTextSmall2'><tr><td><span id='error'>Your password contains special characters! Only     &#x2212;  _ and . can be used.</span></td></tr></table>"
  91.       $check "true";}  
  92.     
  93.     $testnew1 md5($_POST['formPassNew']);
  94.     $testnew2 md5($_POST['formPassNew2']);
  95.     
  96.     if($testnew1 != $testnew2)
  97.     echo '<table border="0" id="TableTextSmall2"><tr><td>Please repeat your new password correctly! Please notice that small letters and capital letters will be considered as separate characters.</td></tr></table>';
  98.     $test123 'true'}
  99.     
  100.     if($check != "true"{
  101.     $ID $_SESSION['log2'];
  102.     $test md5($_POST['formPassOld']);
  103.     $sql "SELECT * FROM user WHERE BINARY ID_User = '$ID' AND Password = '$test'";
  104.     $result mysql_query($sql);
  105.     
  106.     if(!mysql_num_rows($result))
  107.     
  108.     echo '<table border="0" id="TableTextSmall2"><tr><td><span id="error">Please check your current password! Please notice that small letters and capital letters will be considered as separate characters.</span></td></tr></table>';
  109.     $check 'true';}
  110.     
  111.     if(mysql_num_rows($result)) {
  112.     
  113.     while($row mysql_fetch_object($result))
  114.     $Mail $row->Email;  
  115.       $Signature $row->Signature;}
  116.     
  117.     $sql1 "UPDATE user SET Password = '$testnew1' WHERE ID_User = '$ID'";
  118.     $result1 mysql_query($sql1);
  119.     
  120.     $mesg "<font size='9px' face='Arial'><table width='40%'><tr><td colspan='2' align='justify'><b>Dear ".$Signature."</b><br><br></td></tr>";
  121.     $mesg .= "<tr><td colspan='2'>Your password has been changed successfully.</td></tr>";
  122.     $mesg .= "<tr><td>Your new password: </td><td><b>".$_POST['formPassNew']."</b></td></tr>";
  123.     $mesg .= "<tr><td colspan='2'><hr></td></tr>";
  124.     $mesg .= "<tr><td colspan='2'>Sincerely,</td></tr>";
  125.     $mesg .= "<tr><td colspan='2'>Administrator DNA Module</td></tr>";
  126.     
  127.     $from "From: contact@dnabank-network.org\n";
  128.     $from .= "Content-Type: text/html\n";
  129.     
  130.     /********************************************************************************************
  131.     * send email with new password                                                              *
  132.     *********************************************************************************************/
  133.     
  134.     mail($Mail"DNA Module - New Password"$mesg$from);
  135.     
  136.      echo '<table border="0" id="TableTextSmall2">
  137.           <tr><td><span class="fine">Your password have been changed. You will immediately receive a confirmation email.</span></td></tr></table>';  }
  138.     
  139.     }
  140.     //if($formSubmitSearch)
  141.     
  142.     /********************************************************************************************
  143.     * checking and saving new password                                                          *
  144.     * END                                                                                       *
  145.     *********************************************************************************************/
  146.     
  147.     /********************************************************************************************
  148.     * start page                                                                                *
  149.     * START                                                                                     *
  150.     *********************************************************************************************/
  151.        
  152.     if(!$formSubmitSave or $check == 'true'{
  153.        
  154.     ?>   
  155.         <table border="0" id="TableTextSmall2">
  156.           <tr>
  157.                 <td valign="top" colspan="2">
  158.         <h3>Your password</h3>
  159.         </td></tr>
  160.         <tr><td colspan="2">Change password? If you would like to change your password, enter you current password below followed by your new password. Your password must be at least six characters in length and has to contain letters as well as numbers to make it unlikely to be assumed.<br>
  161. Please notice that small letters and capital letters will be considered as separate characters.<br><br></td></tr>
  162.         <tr><td align="right"><b>Enter current password:</b></td><td><input type="password" id="SelectLong" name="formPassOld"/></td></tr>
  163.         <tr><td align="right"><b>Enter new password:</b></td><td><input type="password" id="SelectLong" name="formPassNew"/></td></tr>
  164.         <tr><td align="right"><b>Confirm new password:</b></td><td><input type="password" id="SelectLong" name="formPassNew2"/></td></tr>
  165.       <tr><td></td><td><input type="submit" value="Save" id="SelectLong" name="formSubmitSave" /></td></tr>
  166.  
  167.       </td>
  168.       </tr>
  169.         </table>
  170.     
  171.     
  172.     <?php ?>
  173.     /********************************************************************************************
  174.     * start page                                                                                *
  175.     * END                                                                                       *
  176.     *********************************************************************************************/
  177.     
  178.     
  179.       </form>
  180.         </td>
  181.     </tr>
  182.   <tr>
  183.       <td id="DescriptionBlack" colspan="2"></td>
  184.       <td align="right"><input type="button" value="Return to Configuration Tool" name="formSubmitMenu" id="SelectLong" onClick="self.location.href = 'configuration.php';"></td>
  185.     </tr>
  186. </table>
  187. <?php 
  188.     /**
  189.     * including footer
  190.     */
  191.     include ("../footer.php")?>
  192. </div>
  193.  
  194. </body>
  195.  
  196. </html>

Documentation generated on Tue, 29 Nov 2011 10:44:47 +0100 by phpDocumentor 1.4.3