-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgot.php
154 lines (136 loc) · 4.01 KB
/
forgot.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
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="bootstrap.min.js"></script>
<style type="text/css">
body {
font-size:14px;
alignent:center;
}
span{
color:red;
}
.contact {
text-align:left;
/* background: none repeat scroll 0% 0% #8FBF73;*/
padding: 20px 10px;
box-shadow: 1px 2px 1px #8FBF73;
border-radius: 10px;
width:100%;
}
#er {
color: #F00;
text-align: center;
margin: 10px 0px;
font-size: 17px;
}
</style>
</head>
<body >
<?php
error_reporting('E_ALL ^ E_NOTICE');
if(isset($_POST['submit']))
{
mysql_connect('localhost','root','KNOWledge') or die(mysql_error());
mysql_select_db('MediFind') or die(mysql_error());
$name=$_POST['email'];
$password=$_POST['password'];
$mail=$_POST['mail'];
$q=mysql_query("select * from main where email='".$name."' ") or die(mysql_error());
$n=mysql_fetch_row($q);
if($n>0)
{
$salt = mcrypt_create_iv(22, MCRYPT_DEV_URANDOM);
$salt = base64_encode($salt);
$salt = str_replace('+', '.', $salt);
$hash = crypt($password, '$2y$10$'.$salt.'$');
$insert=mysql_query("UPDATE main SET password='$hash' WHERE email='$name' ");
if($insert)
{
$er='Password updated successfully';
}
}
else
{
$er='User not registered';
}
}
?>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">MediFind</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href="#">Sign Up</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Search Stores</a></li>
<li><a href="#">Search Medicines</a></li>
<li><a href="#">Search Drugs</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="Home.php"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
</ul>
</div>
</nav>
<h1 align="center">Forgot Password?</h1>
<div class="contact">
<div id="er"><?php echo $er?></div>
<div class="container">
<form method="POST" action="#" role="form" class="fform" >
<fieldset>
<br>
<div class="form-group">
<label for="email"> <font color="red">*</font>UserName</label><br>
<input type="text" class="form-group" placeholder="Enter Your UserName" name="email" id="email">
</div>
<div class="form-group">
<label for="password"> <font color="red">*</font>Password</label><br>
<input type="password" class="form-group" placeholder="Enter password" name="password" id="password">
</div>
<div class="form-group">
<label for="cpass"> <font color="red">*</font>Confirm Password</label><br>
<input class="form-group" placeholder="Confirm Password" type="password" name="cpass" id="cpass"><br>
</div>
<div class="form-group">
<input type="submit" name="submit" id="submit" value="Submit">
</div>
</fieldset>
</form>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#submit').click(function() {
var name=document.getElementById('email').value;
var password=document.getElementById('password').value;
var cpass=document.getElementById('cpass').value;
var chk = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if(name=='')
{
$('#er').html('Enter your name');
return false;
}
if(password=='')
{
$('#er').html('Enter your password');
return false;
}
if(cpass=='')
{
$('#er').html('Enter confirm password');
return false;
}
if(cpass!=password)
{
$('#er').html('Passwords Do not match');
return false;
}
});
});
</script>
</body>
</html>