You cannot delete yourself.';
header("Location: " . $_SERVER['REQUEST_URI']);
exit();
}
$success = deleteUser($_POST['userId']);
if ($success) {
$_SESSION['message'] = '
User deleted successfully.
';
} else {
$_SESSION['message'] = 'Failed to delete user.
';
}
header("Location: " . $_SERVER['REQUEST_URI']);
exit();
}
$password = !empty($_POST['password']) ? $_POST['password'] : null;
$_POST['is_admin'] = isset($_POST['is_admin']) ? 1 : 0;
$success = updateUserDetails($_POST['userId'], $_POST['email'], $_POST['firstName'], $_POST['lastName'], $_POST['is_admin'], $password);
if ($success) {
$_SESSION['message'] = 'User updated successfully.
';
} else {
$_SESSION['message'] = 'Failed to update user.
';
}
header("Location: " . $_SERVER['REQUEST_URI']);
exit();
}
?>