-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_user.php
More file actions
24 lines (18 loc) · 764 Bytes
/
delete_user.php
File metadata and controls
24 lines (18 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
session_start();
include('connect/connection.php'); // Ensure database connection
include('UserController.php'); // Include UserController file
$database = new connection(); // Create a connection instance
$pdo = $database->getConnection(); // Retrieve the PDO connection
$userController = new UserController($pdo);
if (isset($_GET['id'])) {
$user_id = $_GET['id'];
if ($userController->deleteUser($user_id)) {
echo "<script>alert('User deleted successfully!'); window.location='manage_users.php';</script>";
} else {
echo "<script>alert('Failed to delete user.'); window.location='manage_users.php';</script>";
}
} else {
echo "<script>alert('Invalid request.'); window.location='manage_users.php';</script>";
}
?>