blocked ips list

This commit is contained in:
Claude 2012-08-31 21:24:34 +02:00
parent e686aa5205
commit a4d19153db
3 changed files with 51 additions and 4 deletions

View File

@ -146,7 +146,10 @@ class Main extends CI_Controller
'constraint' => 16, 'constraint' => 16,
'default' => 0, 'default' => 0,
) , ) ,
//todo 'blocked_at' => array(
'type' => 'INT',
'constraint' => 10,
) ,
'spam_attempts' => array( 'spam_attempts' => array(
'type' => 'INT', 'type' => 'INT',
'constraint' => 6, 'constraint' => 6,

View File

@ -74,8 +74,10 @@ class Spamadmin extends CI_Controller
function blocked_ips() function blocked_ips()
{ {
$this->load->model('pastes'); $this->db->select('ip_address');
$data = $this->pastes->getSpamLists(); $this->db->order_by('blocked_at');
$this->load->view('list_ips', $data); $query = $this->db->get('blocked_ips');
$data['blocked_ips'] = $query->result_array();
$this->load->view('list_blocked_ips', $data);
} }
} }

View File

@ -0,0 +1,42 @@
<?php $this->load->view('defaults/header');?>
<h1><a href="<?php echo site_url('spamadmin'); ?>">Spamadmin</a> - blocked IPs</h1>
<?php
function checkNum($num){
return ($num%2) ? TRUE : FALSE;
}
$n = 0;
if(!empty($blocked_ips)){ ?>
<table class="recent">
<tbody>
<tr>
<th class="title">IP address</th>
<th class="time">When</th>
<th class="time">Spam attempts</th>
<th class="name">Unblock IP</th>
</tr>
<?php foreach($blocked_ips as $ip){
if(checkNum($n) == TRUE) {
$eo = "even";
} else {
$eo = "odd";
}
$n++;
?>
<tr class="<?php echo $eo; ?>">
<td class="first"><?php echo $ip['ip_address']; ?></td>
<td><?php $p = explode(",", timespan($ip['blocked_at'], time())); echo $p[0]; ?> ago.</td>
<td><?php echo '43'; ?></td>
<td><a href="<?php echo site_url('spamadmin/blocked_ips/unblock/' . $ip['ip_address']) ?>">Unblock</a></td>
</tr>
<?php }?>
</tbody>
</table>
<?php } else { ?>
<p>There have been no pastes :(</p>
<?php }?>
<?php echo $pages; ?>
<div class="spacer"></div>
<?php $this->load->view('defaults/footer');?>