-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathForgotPass.php
More file actions
148 lines (107 loc) · 3.01 KB
/
ForgotPass.php
File metadata and controls
148 lines (107 loc) · 3.01 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bidding System</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="CSS/Forgot.css">
<style>
body {
font-family: Agency FB;
}
</style>
<script type="text/javascript">
function ValidateContactForm()
{
var Email=ContactForm.email;
var Pass=ContactForm.Password1;
var conpass=ContactForm.Password2;
if (Email.value=="")
{
window.alert("Enter Your Email");
Email.focus();
return false;
}
if (!validateCaseSensitiveEmail(Email.value))
{
window.alert("Please enter a valid e-mail address.");
email.focus();
return false;
}
if (Pass.value=="")
{
window.alert("Enter Password");
Pass.focus();
return false;
}
if (conpass.value=="")
{
window.alert("Confirm Password");
conpass.focus();
return false;
}
if(Pass.value!=conpass.value)
{
window.alert("Password Miss match");
Pass.focus();
return false;
}
return true;
}
function validateCaseSensitiveEmail(email)
{
var reg = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
if (reg.test(email)){
return true;
}
else{
return false;
}
}
</script>
</head>
<body>
<?php
if ($_SERVER['REQUEST_METHOD']=='POST')
{
$email=$_POST['email'];
$Pass=$_POST['Password1'];
$server="localhost";
$username="root";
$password="";
$db="Bidding";
$connection=mysqli_connect($server,$username,$password,$db);
$search="select * from User where Email='$email'";
$execute=mysqli_query($connection,$search);
if (mysqli_num_rows($execute) > 0) {
$query="update User set Password='$Pass' where Email='$email'";
mysqli_query($connection,$query);
echo "<script> alert('Update Successfully') </script>";
header("Location:UserLogin.php");
}
else
{
echo "<script> alert('Email Does not Exist') </script>";
echo "<script> Pass.focus();</script>";
}
}
?>
<div class="container">
<div class="row">
<div class="login">
<div class="login-triangle"></div>
<h2 class="login-header"><a href="UserLogin.php"><img src="Image/Back.png" width="50px" height="50px"></a>       Change Password</h2>
<form class="login-container" method="POST" name="ContactForm" onsubmit=" return ValidateContactForm();">
<p><input type="email" name="email" placeholder="Email"></p>
<p><input type="password" name="Password1" placeholder="New Password"></p>
<p><input type="password" name="Password2" placeholder="Confirm Password"></p>
<p><input type="submit" value="Change"></p>
</form>
</div>>
</div>
</div>
</body>
</html>