-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_user.php
More file actions
34 lines (28 loc) · 784 Bytes
/
verify_user.php
File metadata and controls
34 lines (28 loc) · 784 Bytes
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
<?php
session_start();
include 'db.php';
// Check if the user is logged in
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
header("Location: splash.php");
exit;
}
// Check if an ID was provided
if (!isset($_GET['id'])) {
header("Location: users.php");
exit;
}
$userId = $_GET['id'];
try {
// Update user status to verified
$sql = "UPDATE user_accounts SET status = 'verified' WHERE id = :id";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':id', $userId);
$stmt->execute();
$_SESSION['success_message'] = "User verified successfully!";
} catch (PDOException $e) {
$_SESSION['error_message'] = "Error verifying user: " . $e->getMessage();
}
// Redirect back to users page
header("Location: users.php");
exit;
?>