-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgot_pwd.php
90 lines (79 loc) · 1.87 KB
/
forgot_pwd.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<html>
<head>
<title>Forgot Password</title>
<link href="css/style.css" rel="stylesheet">
<script>
function validate()
{
var email=document.getElementById("email").value;
if(email=="")
{
alert("Enter Email");
return false;
}
else
{
var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(!filter.test(email))
{
alert("Enter Valid Email");
return false;
}
}
}
</script>
</head>
<body>
<div class="container">
<?php include("menu.php")?>
<div class='body-content'>
<h1>Forgot Password</h1>
<?php
include("connect.php");
if(isset($_POST['submit']))
{
$email=$_POST['email'];
$res=mysqli_query($con,"select Name,Email,Id from reg where Email='$email'");
if(mysqli_num_rows($res)==1)
{
$row=mysqli_fetch_assoc($res);
$uid=base64_encode($row['Id']);
$subject="Recovery Password";
$message="Hi ".$row['Name'].",<br><br>Your
reset password request recieved successfully.Please
click the below link to reset password<br><br>
<a href='http://localhost:8080/9am/reset_pwd.php?uid=$uid'>Reset Password</a><br><br>Thanks
Our Team";
$header="Content-type:text/html";
echo $message;
//mail($email,$subject,$message,$header);
}
else
{
echo "<p>Sorry Email Does not Exists</p>";
}
}
?>
<table>
<form method="POST" action=""
onsubmit="return validate()">
<tr>
<td><label>Email</label></td>
<td>
<input type="text" name="email"
id="email">
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="submit"
value="Submit">
</td>
</tr>
</form>
</table>
</div>
</div>
</body>
</html>