-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
64 lines (61 loc) · 1.79 KB
/
Copy pathadmin.php
File metadata and controls
64 lines (61 loc) · 1.79 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
63
64
<?php
require_once "conn.php";
function xuLyHanhDong($hanhDong) {
switch ($hanhDong) {
case "themdanhmuc":
require_once "admin/ThemDanhMuc.php";
break;
case "xoadanhmuc":
$categoryIdToDelete = $_GET['id'];
pdo_execute("DELETE FROM categories WHERE id = $categoryIdToDelete");
header("LOCATION: admin.php?act=hienthidanhmuc");
break;
case "capnhatdanhmuc":
require_once "admin/CapNhatDanhMuc.php";
break;
case "hienthidanhmuc":
require_once "admin/DanhMuc.php";
break;
case "themsanpham":
require_once "admin/ThemSanPham.php";
break;
case "xoasanpham":
$productIdToDelete = $_GET['id'];
pdo_execute("DELETE FROM items WHERE id = $productIdToDelete");
header("LOCATION: admin.php");
break;
case "capnhatsanpham":
require_once "admin/CapNhatSanPham.php";
break;
case "hienthisanpham":
require_once "admin/SanPham.php";
break;
default:
hienThiTrangChuAdmin();
break;
}
}
function hienThiTrangChuAdmin() {
require_once "admin/TrangChu.php";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Trang admin</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
</head>
<body id="page-top">
<a href="index.php" class="btn btn-primary">Chuyển về trang Frontend</a>
<?php
if (isset($_GET['act'])) {
$hanhDong = $_GET['act'];
xuLyHanhDong($hanhDong);
} else {
hienThiTrangChuAdmin();
}
?>
</body>
</html>