-
Notifications
You must be signed in to change notification settings - Fork 0
/
report.php
61 lines (57 loc) · 1.52 KB
/
report.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
52
53
54
55
56
57
58
59
60
61
<?php
include_once 'includes/session_manager.inc.php';
include_once 'includes/dbh.inc.php';
include_once 'includes/header.inc.php';
if($_SESSION['admin'] == 'Y'){
$entity = $_GET['entity'];
$id = $_GET['id'];
?>
<div id = 'ask'>
<div class="box-nav">
<br/>
<h2>Do you want to delete this <?php echo $entity ?>?</h2>
</div>
<form class = 'input-form' action = '' method = 'POST'>
<button name="submit" value = "Yes"/>Yes</button><br/>
<button name="submit" value = "Nope"/>Nope</button>
</form>
</div>
<?php
if(isset($_POST['submit']) && $_POST['submit'] == "Yes"){
echo "<script> document.getElementById('ask').style.display = 'none' </script> ";
$sql = "UPDATE `".$entity."` SET `STATUS` = 0 where `id` = '$id'";
if ($conn->query($sql) == true){
?> <div class="box-nav">
<br/>
<h2>Entity is deleted. You are free to leave this page.</h2>
</div>
<?php
}
else {
?>
<div class="box-nav">
<br/>
<h2>OOPS! Somethings happened and action not taken. Try again! You are free to leave this page.</h2>
</div>
<?php
}
}
if(isset($_POST['submit']) && $_POST['submit'] == "Nope") {
echo "<script> document.getElementById('ask').style.display = 'none' </script> ";
?>
<div class="box-nav">
<br/>
<h2>You're free to leave this page!</h2>
</div>
<?php
}
}
else {
?>
<div class="box-nav">
<br/>
<h2>Your response has been noted. Mandatory action will be taken. Right now, you're free to leave the page!</h2>
</div>
<?php
}
?>