-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChangePassword2.php~
180 lines (150 loc) · 5.46 KB
/
ChangePassword2.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php
session_start();
$user_name = "root";
$pass_word = "";
$database = "schoolschedule";
$server = "127.0.0.1";
$db_handle = mysql_connect($server,$user_name,$pass_word);
$db_found = mysql_select_db($database,$db_handle);
$SQLteacher = "SELECT * FROM teacher WHERE TeacherID!='ADM' AND TeacherID!='ALL' AND TeacherID!='MUS'";
$TeacherIDResult = mysql_query($SQLteacher);
$TeacherID=$_SESSION['ID'];
$Password=$_POST['Password'];
$PasswordCheck=$_POST['PasswordCheck'];
$PasswordCheckError="";
$TeacherExistenseCheckError="";
$InsertionCheck="";
$PasswordLength = strlen($Password);
if (empty($PasswordCheck)) {
$PasswordCheckError = "Password Verification is required";
}
if($PasswordLength >= 4 && $PasswordLength <= 50) {
$PasswordError = "";
}
else {
$PasswordError = "Password must be less than or equal to 50 characters and greater than or equal to 4 characters";
}
if($Password!=$PasswordCheck) {
$PasswordCheckError='The password you entered does not match';
}
if (empty($Password)) {
$PasswordError = "Password is required";
}
if($PasswordError=="") {
if($PasswordCheckError=="") {
$InsertionCheck='Password successfully changed';
$SQL = "UPDATE admin
SET Password='$Password'
WHERE TeacherID='$TeacherID'";
$result = mysql_query($SQL);
}
}
?>
<html>
<head>
<link href="MyStyle.css" type="text/css" rel="stylesheet">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Settings</title>
</head>
<body>
<ul>
<li2>
<img src="logo.png" height="46" width="40">
</li2>
<li><a href="home.php">Home</a></li>
<li><a href="InsertionMenu.php">Data Insertion</a></li>
<li><a href="assignement.php">Teacher Assignment</a></li>
<li><a href="ScheduleGeneration.php">Generate Schedule</a></li>
<li><a href="search.php">Search Schedule</a></li>
<li><a href="contact.php">Contact</a></li>
<ul style="float: right; list-style-type: none;">
<li>
<a href="about.php">About</a></li>
<li>
<a class="active" href="login.php"><?php if($_SESSION['login']==1) {
echo $_SESSION['UserName'];
}else {
echo 'Login';
} ?></a></li>
</ul>
</ul>
<div style="text-align: center; font-family: Arial; font-size:100%; ">
<h1>Settings</h1>
<table style="width: 100%; height: 516px; text-align: left; margin-left: auto; margin-right: auto;" background="tablebackground.png" border="1" cellpadding="0" cellspacing="0">
<tr>
<td>
<table style="width:25%; height:516px;" background="backgroundforcontact.png" border="0" cellpadding="0" align='center'>
<tr>
<td align='center'>
<img src="settings.png" alt=""><img src="baka2.png" alt="" width="162" height="224">
<table background="backgroundforcontact2.png" style="background-size: 100% 100%; width:80%; height:249px;">
<tr>
<td align='center'>
<table background="backgroundforcontact3.png "style="background-size: 100% 100%";>
<tr>
<td align='center'>
<img src="575346.gif" width="68" height="76">
<table background="backgroundforcontact4.png "style="background-size: 100% 100%; font-size:90%;";>
<form action="ChangePassword2.php" method="post">
<tr>
<td align='center'>
<table>
<tr>
<td>
<font size='2'>New Password</font>
</td>
<td>
<input type="password" name="Password" maxlength="50">
</td>
</tr>
<tr>
<td colspan="2">
<font color='green' size='0.1'><?php echo $InsertionCheck;?></font><font color='red' size='0.1'><?php echo $PasswordError; ?></font>
</td>
</tr>
<tr>
<td>
<font size='2'>Verify Password:</font>
</td>
<td>
<input type="password" name="PasswordCheck" maxlength="50">
</td>
</tr>
<tr>
<td colspan="2">
<font color='red' size='0.1'><?php echo $PasswordCheckError; ?></font>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>
<input type="submit" value="Submit">
</td>
<td>
<a href="settings.php"><button type="button">Return</button></a>
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body></html>