public function getTrustedIp() { return trim(getTrustedClientIP($this->ip, $this->forwardedip)); }
global $smarty; if (isset($_GET['ip']) || isset($_GET['email']) || isset($_GET['name'])) { if (!User::getCurrent()->isAdmin() && !User::getCurrent()->isCheckuser()) { BootstrapSkin::displayAlertBox("Only administrators or checkusers may ban users", "alert-error"); BootstrapSkin::displayInternalFooter(); die; } $database = gGetDb(); // TODO: rewrite me! if (isset($_GET['ip'])) { $query = "SELECT ip, forwardedip FROM request WHERE id = :ip;"; $statement = $database->prepare($query); $statement->bindValue(":ip", $_GET['ip']); $statement->execute(); $row = $statement->fetch(PDO::FETCH_ASSOC); $target = getTrustedClientIP($row['ip'], $row['forwardedip']); $type = "IP"; } elseif (isset($_GET['email'])) { $query = "SELECT email FROM request WHERE id = :ip;"; $statement = $database->prepare($query); $statement->bindValue(":ip", $_GET['email']); $statement->execute(); $row = $statement->fetch(PDO::FETCH_ASSOC); $target = $row['email']; $type = "EMail"; } elseif (isset($_GET['name'])) { $query = "SELECT name FROM request WHERE id = :ip;"; $statement = $database->prepare($query); $statement->bindValue(":ip", $_GET['name']); $statement->execute(); $row = $statement->fetch(PDO::FETCH_ASSOC);