-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete.php
More file actions
37 lines (30 loc) · 771 Bytes
/
Copy pathdelete.php
File metadata and controls
37 lines (30 loc) · 771 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
35
36
37
<?php
require_once "assets/config/config.php";
require_once "vendor/autoload.php";
require_once 'assets/functions/procedural_database_functions.php';
require_once "assets/functions/login_functions.php";
if (!isset($_SESSION['id'])) {
header('Location: login.php');
exit();
}
$id = $_GET['id'] ?? null;
if (!empty($id)) {
$data = fetch_by_id($pdo, 'cms', $id);
/*
* Delete the images from the directory
*/
unlink($data['image_path']);
/*
* Delete the record from the Database Table
*/
$result = delete($id, 'cms', $pdo);
if ($result) {
/*
* Redirect to the Administrator's Home page
*/
header("Location: index.php");
exit();
}
}
header("Location: index.php");
exit();