-
Notifications
You must be signed in to change notification settings - Fork 0
/
forgetPassword.php
40 lines (30 loc) · 1.18 KB
/
forgetPassword.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
// send registration confirmatio link to the email address
// connect to the database and get your name
if(isset($_POST['email'])){
$email = $_POST['email'];
$connect = mysqli_connect("localhost", "root", "", "project");
if($connect){
$select = mysqli_query($connect, "select first_name from users WHERE email='$email' ");
if(mysqli_num_rows($select) == 0){
echo "user does not exist!";
echo "<meta http-equiv='refresh' content='0; url=forgot-password.php'>";
}else{
$to = $email;
$subject = " Password Recovery | (Zee.com)";
$messagebody = "Hello Dear recover-password.php?email='.$email'";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: ' . "[email protected]" . ' <' . "[email protected]" .'>' . " \r\n" .
'Reply-To: '. "[email protected]" . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $messagebody, $headers);
}
}else{
echo "soemthing went wront from db";
}
} // end of first if
else{
echo "something went wrong!";
}
?>