CSY2028-assignment-1/public/admin/deleteAdmin.php

20 lines
593 B
PHP
Raw Normal View History

2022-11-20 21:12:58 +00:00
<?php
session_start();
$pageTitle = 'iBuy - Delete Admin';
$stylesheet = '../assets/ibuy.css';
require_once '../../functions.php';
2022-11-20 21:33:42 +00:00
adminCheck(); //checks to see if user is logged in as admin
2022-11-20 21:12:58 +00:00
if (isset($_GET['admin_id'])) {
$pdo = startDB();
$stmt = $pdo->prepare('DELETE FROM users WHERE user_id= :category_id');
$values = [
'category_id' => $_GET['admin_id']
];
$stmt->execute($values);
2022-11-20 21:33:42 +00:00
echo '<script>window.location.href = "adminCategories.php";</script>'; //redirect
2022-11-20 21:12:58 +00:00
}
else {
2022-11-20 21:33:42 +00:00
echo '<script>window.location.href = "adminCategories.php";</script>'; //redirect
2022-11-20 21:12:58 +00:00
}
?>