-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoggle.php
29 lines (26 loc) · 1.11 KB
/
toggle.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
<?php
// Das was wir wirklich brauchen
require "load.php";
// Hier dann alles andere wie SQL-Queries und so
if (!$loggedin) die("not logged in.");
$id = stripslashes($conn->escape($purifier->purify($_GET["id"])));
$avatar = $conn->where("id", $id)->getOne("avatars");
if ($user["level"] != 10 && ($avatar["user"] != $user["username"])) die("no permission to perform this.");
if ($user["username"] == $avatar["user"] && $user["level"] != 10 && $avatar["by_admin"]) die("no permission to perform this.");
if ($avatar["hidden"]) {
if ($user["level"] == 10)
$conn->where("id", $id)->update("avatars", array("hidden" => false, "by_admin" => false));
else
$conn->where("id", $id)->update("avatars", array("hidden" => false));
} else {
$conn->where("id", $id)->update("avatars", array("hidden" => true));
if ($user["level"] == 10)
$conn->where("id", $id)->update("avatars", array("hidden" => true, "by_admin" => true));
else
$conn->where("id", $id)->update("avatars", array("hidden" => true));
}
echo "visibility has been toggled.";
?>
<script>
window.onload(window.close());
</script>