-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsert_pass.php
More file actions
127 lines (113 loc) · 3.73 KB
/
insert_pass.php
File metadata and controls
127 lines (113 loc) · 3.73 KB
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
<?php
session_start();
$conn = mysqli_connect("localhost","root","","project");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$msg = "";
if(isset($_POST['submit'])) {
$new_password = mysqli_real_escape_string($conn, $_POST['new_password']);
$con_password = mysqli_real_escape_string($conn, $_POST['con_password']);
if($new_password == $con_password) {
// Add WHERE clause to update specific user (using session or other identifier)
$updt_sql = "UPDATE signup SET Password='$new_password' WHERE Email='".$_SESSION['email']."'";
$result = mysqli_query($conn, $updt_sql);
if($result) {
header('location:welcome.php');
exit();
} else {
$msg = "Error updating password: " . mysqli_error($conn);
}
} else {
$msg = "New password does not match with confirm password!";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Password Reset</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: rgb(179, 206, 217);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.verification-container {
background-color: white;
height: 300px;
padding: 30px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
width: 350px;
text-align: center;
}
h1 {
color: #333;
font-size: 24px;
margin-bottom: 20px;
font-weight: normal;
}
.input-field {
width: 100%;
padding: 12px;
margin-bottom: 20px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
font-size: 16px;
}
.error-message {
color: red;
margin-bottom: 15px;
}
.button {
background-color: #257595;
color: white;
border: none;
padding: 12px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 4px;
width: 100%;
}
.back-button {
background-color: #f5f5f5;
color: #333;
border: 1px solid #ddd;
}
.button-container {
display: flex;
gap: 10px;
}
</style>
</head>
<body>
<div class="verification-container" style="width: 400px;">
<h1>Set new password</h1>
<?php if(!empty($msg)): ?>
<div class="error-message"><?php echo $msg; ?></div>
<?php endif; ?>
<form method="POST" action="">
<span style= "position :relative; margin-right:285px" >New Password</span>
<input type="password" name="new_password" class="input-field" placeholder="Enter new password" required>
<span style= "position :relative; margin-right:269px" > Confirm Password</span>
<input type="password" name="con_password" class="input-field" placeholder="Confirm password" required>
<div class="button-container">
<button type="submit" name="submit" class="button">Update Password</button>
<a href="otp.php" class="button back-button">Back</a>
</div>
</form>
</div>
</body>
</html>