-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset_password.php
More file actions
62 lines (57 loc) · 2.22 KB
/
reset_password.php
File metadata and controls
62 lines (57 loc) · 2.22 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
<?php
session_start();
include('db.php');
if (!isset($_SESSION['user_id']) || !$_SESSION['is_admin']) {
header('Location: login.php');
exit();
}
if (isset($_GET['id'])) {
$userId = $_GET['id'];
$db = getDbConnection();
// Get user email for the form
$stmt = $db->prepare('SELECT email FROM users WHERE id = ?');
$stmt->bindValue(1, $userId);
$result = $stmt->execute();
$user = $result->fetchArray(SQLITE3_ASSOC);
if (!$user) {
$_SESSION['error'] = "User not found.";
header('Location: manage_users.php');
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Reset Password</title>
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="icon" href="https://bedfordcollegegroup.ac.uk/hideout-app/themes/the-hideout-theme-group/img/themes/bedford-college/favicon.png">
</head>
<body>
<div class="container">
<div class="form-card">
<h2>Reset Password for <?php echo htmlspecialchars($user['email']); ?></h2>
<form action="process_reset_password.php" method="POST">
<input type="hidden" name="user_id" value="<?php echo $userId; ?>">
<div class="form-group">
<label for="new_password">New Password:</label>
<input type="password" id="new_password" name="new_password" required class="form-input">
</div>
<div class="form-group">
<label for="confirm_password">Confirm Password:</label>
<input type="password" id="confirm_password" name="confirm_password" required class="form-input">
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Reset Password</button>
<a href="manage_users.php" class="btn btn-secondary">Cancel</a>
</div>
</form>
</div>
</div>
</body>
</html>
<?php
exit();
}
header('Location: manage_users.php');
?>