-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdelete.php
121 lines (115 loc) · 4.09 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php require_once("functions.php");
if(empty($_SESSION["user"])){
echo('<meta http-equiv = "refresh" content = "5; URL = process.php?action=login">');
echo "<div align = 'center'>";
echo "Please log in!";
echo "</div>";
die();
}elseif(empty($_GET["id"])) { ?>
<!DOCTYPE html>
<html>
<head>
<title>Discord Bot List - Delete A Bot!</title>
<link
href="https://fonts.googleapis.com/css2?family=Quicksand:wght@600&display=swap"
rel="stylesheet"
/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en" />
<meta charset="utf-8" />
<style>
.success {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.success {
flex-direction: column;
}
</style>
<link rel="stylesheet" type="text/css" href = "css/form.css">
<link rel="stylesheet" type="text/css" href = "css/style.css">
</head>
<body>
<?php require("navbar.php"); ?>
<center>
<div class = "form">
<h3> Delete a bot! </h3>
<form action="delete.php" method="get">
<input type = "text" placeholder = "Please enter ID." name = "id" class = "inp" required>
</br></br></br><button type="submit"> Submit
<span></span>
</button>
</form>
</div>
</center>
</body>
</html>
<?php die();
} else {
require_once("dbConnect.php");
define("discordAPI", "https://discord.com/api/users/@me");
$getBot = $connect->prepare("SELECT * from bots WHERE id = ?");
$getBot->execute(array(filter($_GET["id"])));
$botLength = $getBot->rowCount();
if ($botLength == 0) {
echo('<meta http-equiv = "refresh" content = "5; URL = index.php">');
echo "<div align = 'center'>";
echo "No bot found!";
echo "</div>";
$connect = null;
die();
} else {
$user = apiRequest(discordAPI);
$ownerControl = $connect->prepare("SELECT * from bots WHERE owner = ? AND id = ?");
$ownerControl->execute(array(
filter($user->id),
filter($_GET["id"]),
));
$ownerControlLength = $ownerControl->rowCount();
if ($ownerControlLength == 0) {
echo('<meta http-equiv = "refresh" content = "5; URL = index.php">');
echo "<div align = 'center'>";
echo "No bot found!";
echo "</div>";
$connect = null;
die();
} else {
$deleteBot = $connect->prepare("DELETE FROM bots WHERE id = ? LIMIT 1");
$deleteBot->execute(array(filter($_GET["id"])));
}
}
}
$connect = null;
?>
<!DOCTYPE html>
<html>
<head>
<title>Discord Bot List - Delete A Bot!</title>
<link
href="https://fonts.googleapis.com/css2?family=Quicksand:wght@600&display=swap"
rel="stylesheet"
/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en" />
<meta charset="utf-8" />
<?php require_once("navbar.php"); ?>
<style>
.success {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.success {
flex-direction: column;
}
</style>
</head>
<body>
<div class = "success">
<p>This bot successfully, deleted our system! (ID: <?php echo(filter($_GET["id"])); ?>)</p>
</div>
</body>
</html>