-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpaket_delete.php
33 lines (28 loc) · 903 Bytes
/
paket_delete.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
<?php
//cek session
session_start();
require_once 'config/config.php';
if (empty($_SESSION['loggedin'])) {
header("Location: ./");
die();
} elseif ($_SESSION['level'] === 'Kasir') {
header("Location: ./home.php");
} else {
if (!isset($_GET['id_paket'])) {
header('Location: paket.php');
}
$id_paket = $_GET['id_paket'];
$sql = "SELECT * FROM tb_paket WHERE id_paket=$id_paket";
$query = mysqli_query($db, $sql);
$paket= mysqli_fetch_assoc($query);
if (mysqli_num_rows($query) < 1){
header("Location: paket.php");
} else {
$sql = "DELETE FROM tb_paket WHERE id_paket=$id_paket";
$query = mysqli_query($db, $sql);
if ($query) {
$_SESSION['success'] = 'Data paket berhasil dihapus.';
header('Location: paket.php');
}
}
}