forked from sunnysoni97/libman_php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfirm_delete.php
49 lines (46 loc) · 1.18 KB
/
confirm_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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
session_start();
$state = $_SESSION['state'];
$slevel = $_SESSION['slevel'];
if(!($state="logged in" && ($slevel==1||$slevel==2)))
{
session_destroy();
header('location:login.php?code=1');
}
else
{
$id = $_GET['id'];
$dbtype = $_GET['dbtype'];
if(isset($_POST['yes']))
{
$con = new mysqli("localhost","root","","lib_man");
$com = "delete from $dbtype where $dbtype[0]"."id = $id;";
mysqli_query($con,$com);
echo "<script>
alert('Entry Successfully deleted!');
var parent_window = window.opener.location.pathname+'?id=$id';
window.onunload = window.opener.location.assign(parent_window);
window.close();
</script>";
}
else if(isset($_POST['no']))
{
echo "<script> alert('Seems like you changed your mind!');
window.close();
</script>";
}
}
?>
<html>
<head>
<title> Delete id : <?php echo $id; ?> </title>
</head>
<body bgcolor="black" style="color:white">
<center>
<h2> Are you sure you want to delete ? </h2>
<form method="post">
<input type="submit" name="yes" value="YES"> <input type="submit" name="no" value="NO">
</form>
</center>
</body>
</html>