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