Create menu_manager.php
[clinton/MarylandElectronicPetitionSignature.git] / admin / reset.php
CommitLineData
532de2f1
PM
1<?PHP
2include_once('/var/www/secure.php');
3include('offWorldMail.php');
4if(isset($_POST['email'])){
5 $email = $_POST['email'];
6 $r = $petition->query("SELECT * FROM users WHERE email = '$email'");
7 $row = mysqli_fetch_array($r,MYSQLI_ASSOC);
8 if ($row['email'] != ''){
9 $pass = rand(1000,9999);
10 $salt = md5(rand(1000,9999));
11 $hash = md5($pass.$salt);
12 $encrypted = $hash.':'.$salt;
0e433749 13 off_world_mail($email,$row['name'],'Login with '.$email.' and your new password '.$pass.' at http://md-petition.com/admin/login.php');
532de2f1
PM
14 $petition->query("update users set pass = '$encrypted' WHERE email = '$email'");
15 echo "<h1>Your Password has been Sent.</h1>";
16 }else{
17 echo "<h1>E-Mail address not found.</h1>";
18 }
19}
20?>
21
22<form action="reset.php" method="post" accept-charset="utf-8"> <table>
23 <tbody><tr>
24 <td>E-Mail Address</td>
25 <td><input type="text" name="email" value=""></td>
26 </tr>
27 <tr>
28 <td>&nbsp;</td>
29 <td><input type="submit" name="resetGo" value="Reset Password"></td>
30 </tr>
31 </tbody></table>
32</form>