/
instructor_change_passwd.php
141 lines (135 loc) · 4.33 KB
/
instructor_change_passwd.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
<HTML>
<HEAD>
<TITLE>Change User Password</TITLE>
<META content="Cutepage 2.0" name=GENERATOR></HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<STYLE type=text/css>
<!--
A:link {text-decoration:none; color:"#0000ff"}
A:visited {text-decoration:none}
A:hover {text-decoration:underline; color:"#FF0033"}
body { font-family:"Verdana", "Arial", "Helvetica", "sans-serif"; font-size: 9pt}
p { font-family:"Verdana", "Arial", "Helvetica", "sans-serif"; font-size: 9pt}
td { font-family: "Verdana", "Arial", "Helvetica", "sans-serif"; font-size: 9pt}
-->
</STYLE>
</HEAD>
<BODY background=./image/blackground.gif bgColor=#ffffff>
<TABLE width=1382 height=55 border=0 cellPadding=0 cellSpacing=0>
<TR>
<TD background=./image/top.gif colSpan=2 rowSpan=2>
<DIV align=center><b><font color="#ffffcc" size="5" face="Arial, Helvetica, sans-serif">Change Password</font></b></DIV>
</TD>
<TD bgColor=#00b2eb height=1 width=1145><IMG height=1 src="./image/pixel.gif" width=1></TD>
</TR>
<TR>
<TD bgColor=#ffffff vAlign=bottom>
<DIV align=right></DIV>
</TD>
</TR>
</TABLE>
<TABLE width=865 height="341" border=0 cellPadding=0 cellSpacing=0>
<TR>
<TD colSpan=2 height=24 width=244> </TD>
<TD bgColor=#00b2eb rowSpan=9 width=1><IMG height=1 src="./image/pixel.gif" width=1> </TD>
<TD rowSpan=6 width=10> </TD>
<TD height=24 width=495> </TD>
</TR>
<TR>
<TD colSpan=2 vAlign=top width=244><P align=right> </P>
</TD>
<td width="494" valign="top">
<table width="480" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3">
<div align="center"><font face="Times New Roman, Times, serif"><b><font face="Courier New, Courier, mono">Please enter new credentials</font></b></font></div>
</td>
</tr>
<tr>
<td width="150" height="18">
<p> </p>
<p> </p>
</td>
<td colspan="2"> </td>
</tr>
<form action="instructor_change_passwd.php" method="get">
<tr>
<td colspan="3">
<div align="left">
<blockquote>New Password:
<input type="password" name="password1">
</blockquote>
</div>
</td>
</tr>
<tr>
<td colspan="3">
<div align="left">
<blockquote> Retype New Password:
<input type="password" name="password2">
</blockquote>
</div>
</td>
</tr>
<tr>
<td colspan="3">
<div align="center">
<input type="submit" name="submit" value="Change Password">
</div>
</td>
</tr>
</table>
<?php
session_start();
if(isset($_SESSION["user_id"]))
$user_id=$_SESSION["user_id"];
else
echo "Invalid User!";
require_once "db_connect.php";
$connection=new mysqli($db_hostname,$db_username,$db_password,$db_database);
if($connection->connect_error){
die(connect_error);
}
if(isset($_GET['submit'])){
$password1=$_GET["password1"];
$password2=$_GET["password2"];
if(!empty($password1)&&!empty($password2)){
if($password1==$password2){
$query="update user_pwd set password='$password2' where user_id='$user_id'";
$result=$connection->query($query);
$connection->commit();
mysqli_close($connection);
if($result){
session_destroy();
header('Location: index.html');
} else
echo "Password not changed!";
//sleep(5);
}else{
echo " Password not equal!";
}
}else{
echo " Password can not be empty!";
}
}?>
</td>
</tr>
<tr>
<td colspan="2" rowspan="4" width="244"> </td>
<td width="494" valign="bottom" rowspan="4">
<div align="right">
<table width="480" border="0" cellspacing="0" cellpadding="0" height="29" background="image/button5.gif">
<tr valign="top">
<td> </td>
</tr>
</table>
</div>
<div align="center"> </div>
</td>
</tr>
<tr> </tr>
<tr> </tr>
<tr> </tr>
</table>
</body>
</html>