-
Notifications
You must be signed in to change notification settings - Fork 72
/
resetpassword.php
135 lines (128 loc) · 4.07 KB
/
resetpassword.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
<?php require_once("includes/session.php"); ?>
<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php include("header.php"); ?>
<?php
$_SESSION['uname'] = $_GET['id'];
?>
<?php
if(isset($_POST['submit'])){
$newpass = $_POST['newpass'];
$newpass1 = $_POST['newpass1'];
if(notnull($newpass) && notnull($newpass1)){
$queryresult = mysql_query("select * from owner where and username = '{$_SESSION['uname']}'");
confirm_query($queryresult);
if (mysql_num_rows($queryresult) == 1) {
// username/password authenticated
// and only 1 match
$pass = $newpass;
mysql_query("UPDATE owner set password = '{$pass}' where password = '{$oldpass}' and username = '{$_SESSION['uname']}'");
redirect_to("edit.php?msg=cpsuc");
}
else{
$message = "Password incorrect.<br />
Please make sure your caps lock key is off and try again.";
}
}
}
?>
<body>
<header class="header">
<div style="margin-left:15%; top:0px; position:absolute;">
<a href="index.php" alt="Home" ><img src="images/Logo.png" width="100px" height="60px" /></a></div>
<div style="margin-left:40%; top:0px; position:absolute;">
<h1 align="center">Cabs for Hire</h1></div>
<div style="margin-left:60%; top:20px; position:absolute;">
<?php
if(isset($_SESSION['uname']))
{
$queryresult = mysql_query("select * from owner where and username = '{$_SESSION['uname']}'");
if($queryresult)
{
$qr = mysql_fetch_array($queryresult);
$_SESSION['name'] = $qr['name'];
}
else
$_SESSION['name'] = "User";
echo "<p><span style='font-size:14px; padding:1em; color:#FFFFFF'>" . $_SESSION['name']. "</span>";
echo '<a href="edit.php" id="editform">Edit Profile</a> |
<a href="logout.php" id="logout">Logout</a></p>';
}
else
{
echo ' <p><a href="login.php" id="signin" > Sign in</a></p>';
}
?>
</div>
</header>
<div class="body">
<div class="left">
A@SCARTECH Left
</div>
<div class="main">
<div class="login_form" style="box-sizing:border-box;">
<h2 align="center">Reset Password</h2>
<form name="cp" action="resetpassword.php" method="post" onSubmit="return validate();">
<table>
<tr>
<td>New Password</td>
<td>:<input type="password" name="newpass" maxlength="20" value="" /></td><td><p id="err"></p></td>
</tr>
<tr>
<td>Confirm Password</td>
<td>:<input type="password" name="newpass1" maxlength="20" value="" /></td>
</tr>
<tr><td><h2> <h2></td></tr>
<tr>
<td> </td><td>
<table><tr>
<td><input type="submit" name="submit" value="Submit" style="width:100px;" /></td><td> </td>
<td><input type="reset" name="reset" value="Reset" id="reset" style="width:100px;"/></td>
</tr></table>
</td>
</tr>
</table>
</form>
</div>
</div>
<div class="right">
A@SCAR right Ads
</div>
<footer class="footer">
<p><span class="links"><a href="#" target="_new" >Home</a></span>|<span class="links"><a href="#" target="_new" >About Us</a></span>|<span class="links"><a href="#" target="_new" >Contact Us</a></span>|<span class="links"><a href="#" target="_new" >T & C</a></span><span class="copy">Copyright © A@SCAR 2015</span></p>
</footer>
</body>
<script type="text/javascript">
function validate()
{
var pwd1 = document.cp.newpass.value;
var pwd2 = document.cp.newpass1.value;
var msg = "";
if(pwd1 == "" || pwd2 == "")
{
msg = "Every field must be filled..!";
}
if(pwd1 != pwd2)
msg+="<br>Match Conflict..!";
else if(pwd1.length < 6)
msg += "<br>Must have greater than 6 charecters";
if(msg == "")
{
return true;
}
else
{
$("#err").show();
msg +="<img align='right' src='images/remove.png' width='15px' height='15px'>";
document.getElementById("err").innerHTML = msg;
return false;
}
}
$("#err").click(function(){
$("#err").hide(500);
});
$("#reset").click(function(){
$("#err").hide(500);
});
</script>
</html>