diff options
| author | Michael Save <savetheinternet@tinyboard.org> | 2012-04-13 09:47:27 +1000 |
|---|---|---|
| committer | Michael Save <savetheinternet@tinyboard.org> | 2012-04-13 09:47:27 +1000 |
| commit | 2843ddc4826f250a8af6203cff437929ab807a41 (patch) | |
| tree | a63d0ce133c97356a809237606e5a13dab349c82 /inc/mod/pages.php | |
| parent | 78f3ea783394dba14b51b27f7f2db3974ce8b8b3 (diff) | |
view bans / unban
Diffstat (limited to 'inc/mod/pages.php')
| -rw-r--r-- | inc/mod/pages.php | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/inc/mod/pages.php b/inc/mod/pages.php index c00cd672..e7e4f065 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -94,9 +94,17 @@ function mod_view_thread($boardName, $thread) { function mod_page_ip($ip) { global $config, $mod; - if(filter_var($ip, FILTER_VALIDATE_IP) === false) + if (filter_var($ip, FILTER_VALIDATE_IP) === false) error("Invalid IP address."); + if (isset($_POST['ban_id'], $_POST['unban'])) { + require_once 'inc/mod/ban.php'; + + unban($_POST['ban_id']); + header('Location: ?/IP/' . $ip, true, $config['redirect_http']); + return; + } + $args = array(); $args['ip'] = $ip; $args['posts'] = array(); @@ -134,6 +142,11 @@ function mod_page_ip($ip) { $args['boards'] = $boards; + $query = prepare("SELECT `bans`.*, `username` FROM `bans` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE `ip` = :ip"); + $query->bindValue(':ip', $ip); + $query->execute() or error(db_error($query)); + $args['bans'] = $query->fetchAll(PDO::FETCH_ASSOC); + mod_page("IP: $ip", 'mod/view_ip.html', $args); } @@ -147,8 +160,7 @@ function mod_page_ban() { ban($_POST['ip'], $_POST['reason'], parse_time($_POST['length']), $_POST['board'] == '*' ? false : $_POST['board']); - - if(isset($_POST['redirect'])) + if (isset($_POST['redirect'])) header('Location: ' . $_POST['redirect'], true, $config['redirect_http']); else header('Location: ?/', true, $config['redirect_http']); |
