diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2011-01-15 15:29:05 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2011-01-15 15:29:05 +1100 |
| commit | c2727787aba5cf837af747cfb8b5c61c750c1581 (patch) | |
| tree | 8d5e9c41189a6dcdfbe25467a88b5dbd0b4e7bf7 /mod.php | |
| parent | a0ef70beab3ddcc1d61016d65f9687594d0db5b9 (diff) | |
Basic "IP" page
Diffstat (limited to 'mod.php')
| -rw-r--r-- | mod.php | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -448,6 +448,46 @@ 'mod'=>true ) ); + } elseif(preg_match('/^\/IP\/(\d+\.\d+\.\d+\.\d+)$/', $query, $matches)) { + // View information on an IP address + + $ip = $matches[1]; + $host = MOD_DNS_LOOKUP ? gethostbyaddr($ip) : false; + + $body = ''; + $boards = listBoards(); + foreach($boards as &$_board) { + openBoard($_board['uri']); + + $temp = ''; + $query = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `ip` = :ip ORDER BY `sticky` DESC, `time` LIMIT :limit", $_board['uri'])); + $query->bindValue(':ip', $ip); + $query->bindValue(':limit', MOD_IP_RECENTPOSTS, PDO::PARAM_INT); + $query->execute() or error(db_error($query)); + + while($post = $query->fetch()) { + $po = new Post($post['id'], $post['thread'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $mod ? '?/' : ROOT, $mod); + $temp .= $po->build(); + } + if(!empty($temp)) + $body .= '<fieldset><legend>Last ' . $query->rowCount() . ' posts on <a href="?/' . + sprintf(BOARD_PATH, $_board['uri']) . FILE_INDEX . + '">' . + sprintf(BOARD_ABBREVIATION, $_board['uri']) . ' - ' . $_board['title'] . + '</a></legend>' . $temp . '</fieldset>'; + } + + if(MOD_IP_BANFORM) + $body .= form_newBan($ip, null, isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : false); + + echo Element('page.html', Array( + 'index'=>ROOT, + 'title'=>'IP: ' . $ip, + 'subtitle' => $host, + 'body'=>$body, + 'mod'=>true + ) + ); } else { error(ERROR_404); } |
