Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('./connect1.php');
- $username = $_GET['user'];
- $password = $_GET['pass'];
- $email = "";
- $sql = "SELECT email FROM users WHERE username='$username'";
- $result = mysqli_query($conn, $sql);
- if(mysqli_num_rows($result)>0){
- $row = mysqli_fetch_assoc($result);
- $email = $row['email'];
- }
- else{
- echo "no such user exists";
- }
- $to = $email;
- $from = "gopal@gmail.com";
- $message = "
- <html>
- <head>
- <title>Password Reset</title>
- </head>
- <body>
- <p>Please click on this link to reset your passowrd</p>
- <a href='www.someone.com/login/reset.php?user=".$username."'>Reset Password</a>
- </body>
- </html>
- ";
- $subject = "Password Reset";
- $headers = "MIME-Version: 1.0" . "rn";
- $headers .= "Content-type:text/html;charset=UTF-8" . "rn";
- // More headers
- $headers .= 'From: <gopal@gmail.com>' . "rn";
- mail($to,$subject,$message,$headers);
- echo '<script>alert("Password reset mail has been sent to'.$email.'");</script>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement