-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdroptables.php
88 lines (85 loc) · 2.41 KB
/
droptables.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
<?php
ob_start();
require './config/config.php';
include 'frontend/functions.php';
include("login/auth.php");
if (isset($_SESSION["uname"])) {
$result = $conn->query("SELECT * FROM users,usergroup WHERE uname='" . $_SESSION['uname'] . "' AND users.usergroup = usergroup.id LIMIT 1 ");
$id = $usergroup = "";
while ($row = $result->fetch_assoc()) {
$id = $row['id'];
$uname = $row['uname'];
$email = $row['email'];
$usergroup = $row['groupname'];
if ("$usergroup" == 'admin') {
$sql = "DROP TABLE `gyms`, `pokedex`, `quests`, `raidbosses`, `rewards`, `spotraid`, `spots`, `stops`, `teams`, `usergroup`, `users`";
mysqli_query($conn, $sql);
?>
<html>
<head>
<meta charset="utf-8">
<title>Database Cleared</title>
<meta content="True" name="HandheldFriendly">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="viewport" content="width=device-width">
<meta http-equiv="refresh" content="1; url=./index.php">
<link rel="stylesheet" href="./#/css/style.css" />
</head>
<body>
<center>
<div class='form'>
<h1>Succes</h1>
<h3>Database is cleared</h3>
</div>
</center>
</body>
</html>
<?php
} else {
?>
<html>
<head>
<meta charset="utf-8">
<title>Database Clear Failed</title>
<meta content="True" name="HandheldFriendly">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="./#/css/style.css" />
</head>
<body>
<center>
<div class='form'>
<h1>Error</h1>
<h3>Must be admin to perform database clear</h3><br>
Click here to <a href='./#/#.php'>Login</a>
</div>
</center>
</body>
</html>
<?php
}
}
} else {
?>
<html>
<head>
<meta charset="utf-8">
<title>Not logged in</title>
<meta content="True" name="HandheldFriendly">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="./#/css/style.css" />
</head>
<body>
<center>
<div class='form'>
<h1>Error</h1>
<h3>Please login to perform this action</h3><br>
Click here to <a href='./#/#.php'>Login</a>
</div>
</center>
</body>
</html>
<?php
}
?>