} elseif ($_GET['type'] == "1") { rejectImage($_GET['sid']); header("Location: mod.php"); } elseif ($_GET['type'] == "2") { reportImage($_GET['sid']); header("Location: mod.php"); } elseif ($_GET['type'] == "-1") { if (is_admin(mod_id())) { banUser($_GET['sid'], 0); } header("Location: mod.php"); } elseif ($_GET['type'] == "-2") { if (is_admin(mod_id())) { banUser($_GET['sid'], 1); } header("Location: reports.php"); } elseif ($_GET['type'] == "-3") { if (is_admin(mod_id())) { removeReport($_GET['sid']); } header("Location: reports.php"); } } if ($_GET['type'] == "register") { if (!is_mod(mod_id())) { addModerator(mod_id()); header("Location: mod.php"); } else { header("Location: mod.php"); } }
function banUser($sid, $report) { if ($report == 1) { $sqlstr = "reports"; } else { $sqlstr = "images"; } $sql = "SELECT * FROM `" . $sqlstr . "` WHERE `" . $sqlstr . "`.`sid` = '" . $sid . "'"; if (!($result = $GLOBALS['db']->query($sql))) { die("Database error! (banUser)"); } while ($row = $result->fetch_assoc()) { $sql = "INSERT INTO `bans` (`username`) VALUES ('" . $row['sender'] . "')"; $GLOBALS['db']->query($sql); if ($report == 1) { removeReport($sid); } else { archiveImage($sid); } return true; } }