-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete-question.php
51 lines (49 loc) · 1.52 KB
/
delete-question.php
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
<?php include './components/header.php'; ?>
<?php
$uri = $_SERVER["REQUEST_URI"];
$uri_array = explode("/", $uri);
$qid = $uri_array[3];
$redirect = "/" . $uri_array[5] . "/" . $uri_array[6] . "/" . $uri_array[7];
$delete_question = deleteQuestion($qid);
if ($delete_question === 404) {
echo '<script>
Swal.fire({
title: "Failed!",
text: "Question not found!",
icon: "error",
showConfirmButton: false,
timer: 2500,
});
setTimeout(() => {
document.location.href = "'.$redirect.'"
}, 2500);
</script>';
} elseif ($delete_question === 500) {
echo '<script>
Swal.fire({
title: "Failed!",
text: "Failed delete question!",
icon: "error",
showConfirmButton: false,
timer: 2500,
});
setTimeout(() => {
document.location.href = "'.$redirect.'"
}, 2500);
</script>';
} elseif ($delete_question === 200) {
echo '<script>
Swal.fire({
title: "Success!",
text: "Success delete question!",
icon: "success",
showConfirmButton: false,
timer: 2500,
});
setTimeout(() => {
document.location.href = "'.$redirect.'"
}, 2500);
</script>';
}
?>
<?php include './components/footer.php'; ?>