-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteacher_change_pass.php
86 lines (67 loc) · 2.01 KB
/
teacher_change_pass.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
<?php
include"database.php";
session_start();
if(!isset($_SESSION["TID"]))
{
echo"<script>window.open('teacher_home.php?mes=Access Denied...','_self');</script>";
}
$sql="SELECT * FROM staff WHERE TID={$_SESSION["TID"]}";
$res=$db->query($sql);
if($res->num_rows>0)
{
$row=$res->fetch_assoc();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Change Password</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<?php include"navbar.php";?><br>
<div id="section">
<?php include"sidebar.php";?><br>
<h3 class="text">Welcome <?php echo $_SESSION["TNAME"]; ?></h3><br><hr><br>
<div class="content">
<h3>Change Password</h3><br>
<div class="lbox1">
<?php
if(isset($_POST["submit"]))
{
$sql="select * from staff where TPASS='{$_POST["opass"]}' and TID='{$_SESSION["TID"]}'";
$result=$db->query($sql);
if($result->num_rows>0)
{
if($_POST["npass"]==$_POST["cpass"])
{
$sql="UPDATE staff SET TPASS='{$_POST["npass"]}' where TID='{$_SESSION["TID"]}'";
$db->query($sql);
echo"<div class='success'>password Changed</div>";
}
else
{
echo"<div class='error'>password Mismatch</div>";
}
}
else
{
echo"<div class='error'>Invalid password</div>";
}
}
?>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
<label>Old Password</label><br>
<input type="text" class="input3" name="opass"><br><br>
<label>New Password</label><br>
<input type="text" class="input3" name="npass"><br><br>
<label>Confirm Password</label><br>
<input type="text" class="input3" name="cpass"><br><br>
<button type="submit" class="btn" style="float:left" name="submit"> Change Password</button>
</form>
</div>
</div>
</div>
<?php include"footer.php";?>
</body>
</html>