-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete-task.php
More file actions
30 lines (26 loc) · 694 Bytes
/
Copy pathdelete-task.php
File metadata and controls
30 lines (26 loc) · 694 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
<?php
session_start();
if (isset($_SESSION['role']) && isset($_SESSION['id']) && $_SESSION['role'] == "admin") {
include "DB_connection.php";
include "app/Model/Task.php";
if (!isset($_GET['id'])) {
header("Location: tasks.php");
exit();
}
$id = $_GET['id'];
$task = get_task_by_id($conn, $id);
if ($task == 0) {
header("Location: tasks.php");
exit();
}
$data = array($id);
delete_task($conn, $data);
$sm = "Deleted Successfully";
header("Location: tasks.php?success=$sm");
exit();
}else{
$em = "First login";
header("Location: login.php?error=$em");
exit();
}
?>