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