-
Notifications
You must be signed in to change notification settings - Fork 0
/
forgotpassword.php
150 lines (140 loc) · 4.51 KB
/
forgotpassword.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
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
148
149
150
<html>
<head>
<title>
Forgot Password
</title>
<style>
body{
font-family: Arial, Helvertica, sans-serif;
background-image: url("images/4.jpg");
}
input[type="email"],input[type="password"]{
width: 45%;
height: 40px;
padding: 16px 20px;
margin: 5px 0 22px 0;
display: inline-block;
border: none;
outline: none;
background: whitesmoke ;
}
input[type=email]:focus,input[type=password]:focus{
background-color: #ddd;
outline:none;
}
button{
background-color: rgb(72, 137, 153);
color:black;
padding: 10px 10px;
margin: 50px;
cursor: pointer;
width: 18%;
opacity: 0.9;
}
button:hover{
opacity: 0.8;
}
.mouni{
text-align: center;
margin: 12px 0 12px 0;
position: relative;
}
img.arshi{
width: 7%;
border-radius:5%;
}
.model{
overflow: auto;
padding-top: 4px;
width: 100%;
height:100%;
top: 0%;
left: 0%;
z-index: 1;
position: fixed;
}
.modelcontent{
background-color: rgb(252, 251, 250);
margin: 3% auto 15% auto;
border: 5px solid #888;
width:80%;
text-align: center;
}
.container{
padding:0px;
}
span.psw{
float: right;
padding-top: 16px;
}
#a{
background-color: rgb(218, 231, 230);
}
</style>
</head>
<body>
<div class="model">
<form action="#" method="POST" class="modelcontent">
<h1><b><i>Student Information Forgot Password Page</i></b></h1>
<p>Fill the details to Reset password</p>
<hr>
<div class="mouni">
<img src="images/loginim.png" class="arshi">
</div>
<div class="container">
<br>
<label>EmailID:</label>
<input type="email" name="EmailID" placeholder="EmailID" required>
<br>
<label>New Password:</label>
<input type="password" name="Password" placeholder="New Password" required>
<br>
<label>Confirm New Password:</label>
<input type="password" name="newPassword" placeholder="Confirm New Password" required>
<br>
<button type="submit" name="submit" class="registerbtn">Reset</button>
<br>
<?php
if(isset($_GET['error'])==true)
{
echo "<p style='color:red;'>Email or Passwords doesn't match</p>";
}
?>
</label>
<label><p>Do not have an account?<a href="adminlogin.php">Sign Up</a></p>
</label>
</div>
</form>
</div>
</body>
</html>
<?php
require_once __DIR__ . '/vendor/autoload.php';
$con= new MongoDB\Client("mongodb://localhost:27017");
$db=$con->studentmanagment;
$tb1=$db->table;
if(isset($_POST['submit']))
{
$emailid = $_POST['EmailID'];
$password = $_POST['Password'];
$confi=$_POST['newPassword'];
if($password == $confi )
{
$criteria = array("emailid"=> $emailid);
$data_info=$tb1->find($criteria);
foreach($data_info as $b)
{
if($b[$emaild]=$emailid)
{
$tb1->updateOne(array("emailid"=>$emailid),
array('$set'=>array("password"=>"$password")));
header("location:loginpage.php");
}
}
}
else
{
header("location:forgotpassword.php?error=1");
}
}
?>