-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchange_stud_pass.php
120 lines (114 loc) · 2.64 KB
/
change_stud_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
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
<?php
session_start();
$user = $_SESSION['user'];
$log = $_SESSION['student'];
include 'config/config.php';
if ($log != "log"){
header ("Location: index.php");
}
$msg = "";
if(isset($_POST['submit'])){
$oldpass = $_POST['oldpass'];
$newpass = $_POST['newpass'];
$conpass = $_POST['conpass'];
$res = mysql_query("SELECT * FROM users WHERE user='$user'");
$db_array = mysql_fetch_array($res);
$db_pass = $db_array['pass'];
if($db_pass == $oldpass)
{
if($conpass != $newpass)
{
$msg = "Please enter same password.";
}
else
{
$change = mysql_query("UPDATE users SET pass='$newpass' WHERE user='$user'");
if($change)
{
$msg = "Sucessfully changed.";
}
else
{
$msg = "Try again.";
}
}
}
else
{
$msg = "Wrong old password.";
}
}
?>
<html>
<title>Change Password</title>
<div class="wrapper">
<head>
<style>
.wrapper {
display: flex;
align-items: center;
flex-direction: column;
width: 97%;
min-height: 97%;
padding: 20px;
background: rgba(4, 40, 68, 0.85);
color:white;
font-size: 14px;
}
ul li a
{
color: black;
text-decoration: none;
display: block;
position: relative;
}
ul li a:hover
{
background: #2196F3;
}
form{
text-align: left;
align-items: center;
color:white;
}
h1{
font-family: Kristen ITC;
}
</style>
</head>
<body>
<link href="css/mystyle.css" rel="stylesheet" type="text/css"/>
<h1>Change Password</h1>
<div id="cssmenu">
<ul>
<li><a href="cm_stud1.php">Home</a></li>
<li><a href="change_stud_pass.php">Change Password</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</div>
<br><br><br>
<link href="css/stud.css" rel="stylesheet" type="text/css"/>
<table class="reference" style="width:35%">
<form action='change_stud_pass.php' method='POST'>
<tr>
<td>Old Password :</td>
<td><input type='password' name='oldpass' ></td>
</tr>
<tr>
<td>New Password :</td>
<td> <input type='password' name='newpass'></td>
</tr>
<tr>
<td> Confirm Pass :</td>
<td> <input type='password' name='conpass'></td>
</tr>
<tr>
<td></td>
<td><input type='submit' name='submit' value='submit'></td>
</tr>
</form>
</table>
<br><br>
<?php if($msg){ echo "$msg"; } ?>
</body>
</html>