-
Notifications
You must be signed in to change notification settings - Fork 0
/
forgot_psd.php
153 lines (112 loc) · 4.47 KB
/
forgot_psd.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Vision | Login</title>
<!-- Bootstrap core CSS-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- css-->
<link href="css/styling.css" rel="stylesheet">
<!-- ************* google fonts****************-->
<link href="https://fonts.googleapis.com/css?family=Sree+Krushnadevaraya" rel="stylesheet">
</head>
<body class="login-bdy">
<div class="container login-contn">
<div class="row">
<div class="col-md-4 col-sm-12 col-xs-12"></div>
<div class="col-md-4 col-sm-12 col-xs-12 login_content">
<form method="post" action="" class="form-container" onsubmit="return verify()">
<h1>Login Form</h1>
<div class="form-group input-field">
<label for="exampleInputEmail1">Username</label>
<input class="form-control" type="text" name="username">
</div>
<div class="form-group input-field">
<label for="exampleInputPassword1">New Password</label>
<input class="form-control" type="password" id="new" name="new">
</div>
<div class="form-group input-field">
<label for="exampleInputPassword1">Confirm Password</label>
<input class="form-control" type="password" id="new2" name="confirmpassword">
<span id="a"></span>
</div>
<!--
<div class="form-group">
<div class="form-check">
<label class="form-check-label">
<input class="form-check-input" type="checkbox"> Remember Password</label>
</div>
</div>
-->
<button type="submit" class="btn btn-login btn-block" name="submit">CHANGE</button>
</form>
</div>
<div class="col-md-4 col-sm-12 col-xs-12"></div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
</body>
<script>
function verify()
{
var qw=0;
var n1=document.getElementById("new").value;
var n2=document.getElementById("new2").value;
if(n1 != n2)
{
document.getElementById("a").innerHTML="password Doesn't Match";
document.getElementById("new").style.border="2px solid red";
document.getElementById("new2").style.border="2px solid red";
qw=1;
}
else{
document.getElementById("a").innerHTML="";
}
if(qw!=0)
{
return false;
}
return true;
}
</script>
</html>
<?php
if(isset($_POST['submit']))
{
$user=$_POST["username"];
$conn=new mysqli('localhost','root','','login_web');
$sql ="select * from users where username='$user'";
$data=$conn->query($sql);
if($data -> num_rows >0)
{
$password=$_POST["new"];
$password = md5($password);
$sql1= "update users set password='$password' where username='$user'";
$data1=$conn->query($sql1);
if($data1 === true)
{
echo "changed";
header('location: login.php');
}else
{
echo "cant changed";
}
}
else
{
echo "invalid username";
}
}
?>