-
Notifications
You must be signed in to change notification settings - Fork 3
/
reset.php
163 lines (136 loc) · 3.21 KB
/
reset.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
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
session_start();
if(!isset($_SESSION['sess_emai']) ){
header("location:login.php");
} else { }
$conn= mysqli_connect('localhost','root','','mydb') or die(mysql_error());
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
?>
<!doctype html>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Nanum+Gothic" rel="stylesheet">
<title>Change Password</title>
<h2>Welcome, <? echo $_SESSION['sess_emai'];?>! </h2> <br><br><br>
<style>
@media screen and (min-width: 50rem) {
.outer-box-frame {
border: 0.3rem solid #B22222;
margin-top: 3px;
margin-left: 5rem ; /*the auto for the left/right keeps the page centered*/
padding: 5rem;
max-width: 38000rem; // min-width - 2(padding + border)
}
body {
background-color: #6C8C4C;
}
}
.outer-box-frame {
background-color: #fff;
}
input.c
{
margin-left: 34px;
}
input.d
{
margin-left: 5px;
}
body{
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px;
background-color: azure ;
color: black;
font-family: 'Nanum Gothic', sans-serif;
font-size: 20px;
}
h2 {
color: indigo;
font-family: 'Nanum Gothic', sans-serif;
font-size:30px;
position: absolute;
top: 0;
RIGHT: 0;
}
form.m
{
margin-left: 50px;
}
form.n
{
margin-left: 500px;
}
input.b,.btn-group button{
border-radius: 1px;
border: none;
text-align: center;
font-size: 18px;
padding: 8px;
width: 110px;
transition: all 0.5s;
cursor: pointer;
margin: 5px;
align:center;
color: #800000
font-family: 'Nanum Gothic', sans-serif;
margin-left: 3px;
margin-top: 20px;
}
input.b,.btn-group button{
content: "";
clear: both;
display: table;
}
input.b,.btn-group button {
border-right: none;
}
input.b:hover,.btn-group button:hover {
background-color: #B0E0E6;
font-family: 'Nanum Gothic', sans-serif;
font-size: 16px;
}
.btn-group button
{
position: absolute;
top: 120;
right: 19;
}
</style>
</head>
<body>
<center>
<div class="outer-box-frame">
<form action="" method="POST" class="a">
Password: <input type="password" name="pass1" class="c" ><br /> <br>
Re-Password: <input type="password" name="pass2" class="d" ><br /> <br>
<input type="submit" value="SUBMIT" name="submit" class="b"/>
</form></center>
<?php
if(isset($_POST["submit"])){
if(!empty($_POST['pass1']) && !empty($_POST['pass1'])) {
$pass1=$_POST['pass1'];
$pass2=$_POST['pass2'];
$conn=mysqli_connect('localhost','root','') or die(mysql_error());
mysqli_select_db($conn,'mydb') or die("cannot select DB");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if($pass1==$pass2)
{
$result = mysqli_query($conn, "UPDATE login set password = '".$pass1."' where email ='".$_SESSION['sess_emai']."'");
echo "Password changed";
}
else
{
echo "Warning-> Password and conformation password both are not same!!!";
}}
else {
echo "Warning-> All fields are required !"; }}
?>
</div>
</body>
</html>