Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "bmisystem";
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- // Check connection
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- $email = $_POST['email'];
- $sql = "SELECT * FROM users WHERE u_email='$email'";
- $result = mysqli_query($conn, $sql);
- if (mysqli_num_rows($result) > 0) {
- while($row = mysqli_fetch_assoc($result)) {
- $to = $row['u_email'];
- $pass = $row['u_pass'];
- $name = $row['first_name'];
- $msg = '
- Hi '.$name.' <br>
- Your Login Password is '.$pass.' <br>
- Thank you
- ';
- $subject = "Password Recovery Notification";
- $from = "no-reply@progsofts.com";
- }
- if ($to = $email){
- $send = mail($to, $subject, $msg, $from);
- }
- if($send){
- echo "<script>alert('Password has been sent to your Email.. Thanks');</script>";
- }
- }else{
- echo "<script>alert('EMail ID you provided is not assigned to any account. Try again with a correct email');</script>";
- }
- mysqli_close($conn);
- ?>
- <table border="0" style="width:400px;margin:0 auto;border:2px solid #F25822;
- border-radius:5px;padding-top:15px;padding-left:5px;padding-bottom:15px;padding-right:5px;box-shadow:0px 0px 5px 5px grey;margin-top:40px;margin-bottom:30px;">
- <tr>
- <td> Please Provide your Registered Email to recover </td></tr>
- <tr><td><hr><td></tr>
- <tr>
- <form name="recover" method="post" action="recover.php">
- <td><input type="email" size="40" name="email"></td></tr>
- <tr><td align="center"><input type="submit" value="Send Password" class="button" required style="width:200px;"></td></tr>
- </form>
- </table>
- </div>
- <?php
- include 'footer.php';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement