-
Notifications
You must be signed in to change notification settings - Fork 0
/
resetPassword.php
61 lines (61 loc) · 1.99 KB
/
resetPassword.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
<?php
require("connect.php");
if(isset($_GET['username']) && isset($_GET['alterPIN'])){
$user=$_GET['username'];
$alterPIN=$_GET['alterPIN'];
}
else{
header("Location: index.php");
}
echo "<span style='opacity: 0'>trigger now</span>";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reset Password</title>
<link rel="stylesheet" type="text/css" href="loginPage.css?ver=<?php echo rand(111,999);?>">
</head>
<body>
<div class="formBox">
<img src="ultFinal.jpg" alt="logo" class="image">
<h1 data-text="ENTER JIIT NETWORK">ENTER JIIT NETWORK</h1>
<form action=<?php echo"resetPassword.php?username=$user&alterPIN=$alterPIN";?> method="POST">
<div class="inputBox">
<input type="password" name="pass" placeholder=" ">
<label name="pass">
Password
</label>
</div>
<div class="inputBox">
<input type="password" name="cpass" placeholder=" ">
<label name="c-pass">
Confirm Password
</label>
</div>
<div class="inputBox">
<button type="submit" name="reset">Reset Password</button>
</div>
</form>
</div>
</body>
</html>
<?php
if($_SERVER["REQUEST_METHOD"]=="POST"){
if(isset($_POST["reset"])){
$pass=$_POST["pass"];
$cpass=$_POST["cpass"];
if($pass==$cpass){
$pass_md5=md5($pass);
$sql1="update userData set password='$pass_md5' where username='$user'";
if($conn->query($sql1)){
header("Location: index.php?success=1");
}
}
else{
echo"<center><h3 style='color: red'>Passwords don't match!</h1></center>";
}
}
}
?>