<?php session_start(); include 'assets/settings.php'; include 'user.php'; $categories = $db->getCategories(); $category = isset($_GET['show']) ? cleanInt($_GET['show']) : -1; if (!$db->isValidCategory($category)) { $category = -1; } $page = isset($_GET['page']) && is_numeric($_GET['page']) ? cleanInt($_GET['page']) : 1; $sort = isset($_SESSION['sort']) ? $_SESSION['sort'] : "last_post"; if (isset($_GET['sort']) && ($_GET['sort'] == "latest" || $_GET['sort'] == "liked")) { $_SESSION['sort'] = $_GET['sort'] == "latest" ? "last_post" : "likes"; header("location:index.php?" . ($category == -1 ? "" : "show=" . $category . "&") . "page=" . $page); exit; } ?> <!DOCTYPE html> <html> <?php include 'assets/templates/global/head.php'; ?> <body> <?php include 'assets/templates/global/navigation.php'; ?> <header class="jumbotron"> <div class="container">
if ($newuser['banned'] == 1) { $_SESSION['error'] = $newuser['username'] . " is already banned!"; } else { if ($newuser['id'] == $user['id']) { $_SESSION['error'] = 'You are not allowed to ban yourself!'; } else { $db->setBanned($newuser['id'], 1); $_SESSION['success'] = $newuser['username'] . " has been banned!"; } } } header("location: admin.php"); exit; } if (isset($_GET['unban'])) { $ruser = $db->getUserById(cleanInt($_GET['unban'])); if ($ruser == null) { $_SESSION['error'] = 'Somehow, this user does not exist.'; } else { if ($ruser['banned'] == 0) { $_SESSION['error'] = $ruser['username'] . ' is not banned'; } else { $db->setBanned($ruser['id'], 0); $_SESSION['success'] = $ruser['username'] . ' has been unbanned'; } } header("location: admin.php"); exit; } } ?>