-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathforgot-password.php
119 lines (99 loc) · 3.97 KB
/
forgot-password.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
<?php
session_start();
error_reporting(0);
include('includes/dbconnection.php');
if (isset($_POST['submit'])) {
$email = $_POST['email'];
$deptid = $_POST['deptid'];
$role_id = $_POST['role_id'];
$newpassword = md5($_POST['newpassword']);
$sql = "SELECT email FROM users WHERE email=:email and dept_id=:deptid and role_id=:role_id ";
$query = $dbh->prepare($sql);
$query->bindParam(':email', $email, PDO::PARAM_STR);
$query->bindParam(':deptid', $deptid, PDO::PARAM_STR);
$query->bindParam(':role_id', $role_id, PDO::PARAM_STR);
$query->execute();
$results = $query->fetchAll(PDO::FETCH_OBJ);
if ($query->rowCount() > 0) {
$con = "update users set password=:newpassword where email=:email and dept_id=:deptid and role_id=:role_id ";
$chngpwd1 = $dbh->prepare($con);
$chngpwd1->bindParam(':email', $email, PDO::PARAM_STR);
$chngpwd1->bindParam(':deptid', $deptid, PDO::PARAM_STR);
$chngpwd1->bindParam(':role_id', $role_id, PDO::PARAM_STR);
$chngpwd1->bindParam(':newpassword', $newpassword, PDO::PARAM_STR);
$chngpwd1->execute();
echo "<script>alert('Your Password succesfully changed');</script>";
} else {
echo "<script>alert('Email id or dept id or role id is invalid');</script>";
}
}
?>
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>E-Filing System - Forgot Page</title>
<link rel="stylesheet" href="libs/bower/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="libs/bower/material-design-iconic-font/dist/css/material-design-iconic-font.min.css">
<link rel="stylesheet" href="libs/bower/animate.css/animate.min.css">
<link rel="stylesheet" href="assets/css/bootstrap.css">
<link rel="stylesheet" href="assets/css/core.css">
<link rel="stylesheet" href="assets/css/misc-pages.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,900,300">
<script type="text/javascript">
function valid() {
if (document.chngpwd.newpassword.value != document.chngpwd.confirmpassword.value) {
alert("New Password and Confirm Password Field do not match !!");
document.chngpwd.confirmpassword.focus();
return false;
}
return true;
}
</script>
<style>
body {
background-image: url('assets/images/image/homepage.png');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
</style>
</head>
<body class="simple-page">
<div id="back-to-home">
<a href="login.php" class="btn btn-outline btn-default"><i class="fa fa-home animated zoomIn"></i></a>
</div>
<div class="simple-page-wrap">
<div class="simple-page-logo animated swing">
<span style="color: white"><i class="fa fa-gg"></i></span>
<span style="color: white">E-Filing System</span>
</div><!-- logo -->
<div class="simple-page-form animated flipInY" id="login-form">
<h4 class="form-title m-b-xl text-center">Reset Your Password</h4>
<form method="post" name="chngpwd" onSubmit="return valid();">
<div class="form-group">
<input type="text" class="form-control" placeholder="Email Address" required="true" name="email">
</div>
<div class="form-group">
<input type="text" class="form-control" name="deptid" placeholder="Department no" required="true">
</div>
<div class="form-group">
<input type="text" class="form-control" name="role_id" placeholder="role no" required="true">
</div>
<div class="form-group">
<input class="form-control" type="password" name="newpassword" placeholder="New Password"
required="true" />
</div>
<div class="form-group">
<input class="form-control" type="password" name="confirmpassword" placeholder="Confirm Password"
required="true" />
</div>
<input type="submit" class="btn btn-primary" name="submit" value="RESET">
</form>
</div><!-- #login-form -->
<div class="simple-page-footer">
<p style="color: white">Do you have an account ?<a href="login.php"> SIGN IN</a></p>
</div><!-- .simple-page-footer -->
</div><!-- .simple-page-wrap -->
</body>
</html>