-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeleting.php
More file actions
71 lines (59 loc) · 1.4 KB
/
Copy pathdeleting.php
File metadata and controls
71 lines (59 loc) · 1.4 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
65
66
67
68
69
70
71
<?php
session_start();
include('config.php');
if(isset($_GET['ID']))
{
$id = $_GET['ID'];
$data = mysqli_query($db_connection, "SELECT * FROM `daftar user` WHERE ID='$id'");
$check = mysqli_num_rows($data);
$editrole = " ";
$editmail = " ";
if($check > 0)
{
while($row = $data->fetch_assoc())
{
$editrole = $row["Role"];
$editmail = $row["Email"];
}
}
if($_SESSION['status']!="login")
{
header("location:index.php?info=not_yet");
}
if($_SESSION['role']=="User")
{
header("location:main-page.php");
}
if(($_SESSION['role']!="Superadmin" && $editrole=="Superadmin") || $check < 1)
{
header("location:full_operatives.php");
}
if (($editrole=='Superadmin' || $editrole=='Admin') && ($_SESSION['email']!=$editmail && $_SESSION['role']!='Superadmin'))
{
header("location:full_operatives.php");
}
if(($_SESSION['role']=="Superadmin" && $editrole=="Superadmin") && $editmail!=$_SESSION['email'])
{
header("location:full_operatives.php");
}
$sql1 = "DELETE FROM `daftar user` WHERE ID='$id'";
$query = mysqli_query($db_connection, $sql1);
if (!$query)
{
header('Location: full_operatives.php?info=fail');
}
if ($query)
{
if ($_SESSION['email']==$editmail)
{
session_destroy();
header("location:index.php?info=deleted");
}
header('Location: full_operatives.php?info=success');
}
}
if(!isset($_GET['ID']))
{
header("location:full_operatives.php?info=fail");
}
?>