* Script for changing password *

* Access for all users * @author Gabriele Droege, DNA Bank Network * @version 2.0 * @package Configuration * @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org
The contents of this file are subject to the Mozilla Public License Version 1.1 * @filesource * @license http://www.mozilla.org/MPL/ MPL */ /** * calling connection to database */ include ("../config/head.php"); /** * calling authorisation script */ include ("../auth.php"); ?> DNA Module - Configuration tool

Configuration Tool
Change Password

Please complete all fields!
'; $test123 = 'true';} if($_POST['formPassNew'] != "" and strlen($_POST['formPassNew']) < 6) { echo "
Your password is too short.
"; $check = "true";} if ($_POST['formPassNew'] != "" and preg_match("/^[0-9]+$/", $_POST['formPassNew'])) { echo "
Your password contains numbers only.
"; $check = "true"; } if ($_POST['formPassNew'] != "" and preg_match("/^[a-zA-Z]+$/", $_POST['formPassNew'])) { echo "
Your password contents letters only.
"; $check = "true";} if ($_POST['formPassNew'] != "" and preg_match('/[^a-zA-Z0-9-_.]/', $_POST['formPassNew'])) { echo "
Your password contains special characters! Only − _ and . can be used.
"; $check = "true";} $testnew1 = md5($_POST['formPassNew']); $testnew2 = md5($_POST['formPassNew2']); if($testnew1 != $testnew2) { echo '
Please repeat your new password correctly! Please notice that small letters and capital letters will be considered as separate characters.
'; $test123 = 'true'; } if($check != "true") { $ID = $_SESSION['log2']; $test = md5($_POST['formPassOld']); $sql = "SELECT * FROM user WHERE BINARY ID_User = '$ID' AND Password = '$test'"; $result = mysqli_query($GLOBALS["___mysqli_ston"], $sql); if(!mysqli_num_rows($result)) { echo '
Please check your current password! Please notice that small letters and capital letters will be considered as separate characters.
'; $check = 'true';} if(mysqli_num_rows($result)) { while($row = mysqli_fetch_object($result)) { $Mail = $row->Email; $Signature = $row->Signature;} $sql1 = "UPDATE user SET Password = '$testnew1' WHERE ID_User = '$ID'"; $result1 = mysqli_query($GLOBALS["___mysqli_ston"], $sql1); $mesg = ""; $mesg .= ""; $mesg .= ""; $mesg .= ""; $mesg .= ""; $mesg .= ""; $from = "From: contact@dnabank-network.org\n"; $from .= "Content-Type: text/html\n"; /******************************************************************************************** * send email with new password * *********************************************************************************************/ mail($Mail, "DNA Module - New Password", $mesg, $from); echo '
Dear ".$Signature."

Your password has been changed successfully.
Your new password: ".$_POST['formPassNew']."

Sincerely,
Administrator DNA Module
Your password have been changed. You will immediately receive a confirmation email.
'; } } } //if($formSubmitSearch) /******************************************************************************************** * checking and saving new password * * END * *********************************************************************************************/ /******************************************************************************************** * start page * * START * *********************************************************************************************/ if(!$formSubmitSave or $check == 'true') { ?>

Your password

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.
Please notice that small letters and capital letters will be considered as separate characters.

Enter current password:
Enter new password:
Confirm new password: