-
Notifications
You must be signed in to change notification settings - Fork 6
/
pass_chg.php
44 lines (39 loc) · 1.18 KB
/
pass_chg.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
<?php
ob_start();
include 'dashboard.php';
ob_end_clean();
?>
<html>
<head>
<title>Password Change</title>
</head>
<body>
<h1>Change Password</h1><br/>
<form method="get" action=''>
Enter New Password: <input type="text" name="new_password"/><br/><br/>
Confirm Password: <input type="text" name="confirm_password"/><br/><br/>
<input type="submit" name="submit"/>
</form>
</body>
</html>
<?php
$link = new mysqli("localhost","root","","studyportal");
if($link->connect_error){
echo "Connection Error: ".$link->connect_error;
}
if(isset($_GET['submit'])){
$newp = $_GET['new_password'];
$confirmp = $_GET['confirm_password'];
if($newp === $confirmp){
$change = $link->query("UPDATE register set password='hacked' where username='$login_session'");
if($change){
echo "<script type='text/javascript'>alert('Change Successful!');</script>";
echo "<a href=dashboard.php>Click Here</a> to go to dashboard";
}
}
else{
echo "<script type='text/javascript'>alert('Entries don't match!');</script>";
echo "<a href=pass_chg.php>Click Here</a> to Retry!";
}
}
?>