mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 12:31:06 -05:00
ip admin
This commit is contained in:
parent
0523752675
commit
7eac462a1f
@ -53,7 +53,7 @@ $route['lists'] = 'main/lists';
|
||||
$route['lists/rss'] = 'main/lists/rss';
|
||||
$route['lists/:num'] = 'main/lists/$1';
|
||||
$route['spamadmin/:num'] = 'spamadmin/index';
|
||||
$route['spamadmin/session/:any'] = 'spamadmin/session';
|
||||
$route['spamadmin/:any'] = 'spamadmin/spam_detail';
|
||||
$route['about'] = 'main/about';
|
||||
|
||||
$route['iphone/:num'] = 'iphone';
|
||||
|
@ -151,8 +151,6 @@ class Main extends CI_Controller
|
||||
$this->dbforge->add_key('ip_address', true);
|
||||
$this->dbforge->create_table('blocked_ips', true);
|
||||
}
|
||||
|
||||
//check if field session_id exists
|
||||
|
||||
if (!$this->db->field_exists('ip_address', 'pastes'))
|
||||
{
|
||||
|
@ -32,28 +32,17 @@ class Spamadmin extends CI_Controller
|
||||
{
|
||||
$this->load->model('pastes');
|
||||
$data = $this->pastes->getSpamLists();
|
||||
$this->load->view('spamlist', $data);
|
||||
$this->load->view('list_ips', $data);
|
||||
}
|
||||
|
||||
function session()
|
||||
function spam_detail()
|
||||
{
|
||||
$this->load->model('pastes');
|
||||
|
||||
//sessionid
|
||||
$session_id = $this->uri->segment(3);
|
||||
|
||||
//get ip
|
||||
$this->db->select('ip_address');
|
||||
$this->db->where('session_id', $session_id);
|
||||
$query = $this->db->get('ci_sessions');
|
||||
$r = $query->result_array();
|
||||
$ip_address = $r[0]['ip_address'];
|
||||
|
||||
//removal
|
||||
$ip_address = $this->uri->segment(2);
|
||||
|
||||
if ($this->input->post('confirm_remove') && $session_id != '')
|
||||
if ($this->input->post('confirm_remove') && $ip_address != '')
|
||||
{
|
||||
$this->db->where('session_id', $session_id);
|
||||
$this->db->where('ip_address', $ip_address);
|
||||
$this->db->delete('pastes');
|
||||
|
||||
if ($this->input->post('block_ip'))
|
||||
@ -65,11 +54,10 @@ class Spamadmin extends CI_Controller
|
||||
}
|
||||
|
||||
//fill data
|
||||
$data = $this->pastes->getSpamLists('spamadmin/session/' . $session_id, $seg = 4, $session_id);
|
||||
$data['session_id'] = $session_id;
|
||||
$data = $this->pastes->getSpamLists('spamadmin/' . $ip_address, $seg = 3, $ip_address);
|
||||
$data['ip_address'] = $ip_address;
|
||||
|
||||
//view
|
||||
$this->load->view('list_sessionid', $data);
|
||||
$this->load->view('spam_detail', $data);
|
||||
}
|
||||
}
|
||||
|
@ -24,13 +24,13 @@ class Pastes extends CI_Model
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function countPastes($session_id = false)
|
||||
function countPastes($ip_address = false)
|
||||
{
|
||||
$this->db->where('private', 0);
|
||||
|
||||
if ($session_id)
|
||||
if ($ip_address)
|
||||
{
|
||||
$this->db->where('session_id', $session_id);
|
||||
$this->db->where('ip_address', $ip_address);
|
||||
}
|
||||
$query = $this->db->get('pastes');
|
||||
return $query->num_rows();
|
||||
@ -372,7 +372,7 @@ class Pastes extends CI_Model
|
||||
return $data;
|
||||
}
|
||||
|
||||
function getSpamLists($root = 'spamadmin/', $seg = 2, $session_id = false)
|
||||
function getSpamLists($root = 'spamadmin/', $seg = 2, $ip_address = false)
|
||||
{
|
||||
$this->load->library('pagination');
|
||||
$this->load->library('process');
|
||||
@ -386,12 +386,12 @@ class Pastes extends CI_Model
|
||||
{
|
||||
$page = $this->uri->segment($seg);
|
||||
}
|
||||
$this->db->select('id, title, name, created, pid, lang, session_id');
|
||||
$this->db->select('id, title, name, created, pid, lang, ip_address');
|
||||
$this->db->where('private', 0);
|
||||
|
||||
if ($session_id)
|
||||
if ($ip_address)
|
||||
{
|
||||
$this->db->where('session_id', $session_id);
|
||||
$this->db->where('ip_address', $ip_address);
|
||||
}
|
||||
$this->db->order_by('created', 'desc');
|
||||
$query = $this->db->get('pastes', $amount, $page);
|
||||
@ -407,12 +407,12 @@ class Pastes extends CI_Model
|
||||
$data['pastes'][$n]['created'] = $row['created'];
|
||||
$data['pastes'][$n]['lang'] = $row['lang'];
|
||||
$data['pastes'][$n]['pid'] = $row['pid'];
|
||||
$data['pastes'][$n]['session_id'] = $row['session_id'];
|
||||
$data['pastes'][$n]['ip_address'] = $row['ip_address'];
|
||||
$n++;
|
||||
}
|
||||
}
|
||||
$config['base_url'] = site_url($root);
|
||||
$config['total_rows'] = $this->countPastes($session_id);
|
||||
$config['total_rows'] = $this->countPastes($ip_address);
|
||||
$config['per_page'] = $amount;
|
||||
$config['num_links'] = 9;
|
||||
$config['full_tag_open'] = '<div class="pages">';
|
||||
|
@ -1,11 +1,11 @@
|
||||
<?php $this->load->view('defaults/header');?>
|
||||
<h1>Spamadmin</h1>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
function checkNum($num){
|
||||
return ($num%2) ? TRUE : FALSE;
|
||||
}
|
||||
$n = 0;
|
||||
$n = 0;
|
||||
if(!empty($pastes)){ ?>
|
||||
<table class="recent">
|
||||
<tbody>
|
||||
@ -14,7 +14,7 @@
|
||||
<th class="name">Name</th>
|
||||
<th class="lang">Language</th>
|
||||
<th class="time">When</th>
|
||||
<th class="time">Session</th>
|
||||
<th class="time">IP</th>
|
||||
</tr>
|
||||
<?php foreach($pastes as $paste) {
|
||||
if(checkNum($n) == TRUE) {
|
||||
@ -23,19 +23,19 @@
|
||||
$eo = "odd";
|
||||
}
|
||||
$n++;
|
||||
?>
|
||||
?>
|
||||
|
||||
<tr class="<?php echo $eo; ?>">
|
||||
<td class="first"><a href="<?php echo site_url("view/".$paste['pid']); ?>"><?php echo $paste['title']; ?></a></td>
|
||||
<td><?php echo $paste['name']; ?></td>
|
||||
<td><?php echo $paste['lang']; ?></td>
|
||||
<td><?php $p = explode(",", timespan($paste['created'], time())); echo $p[0]; ?> ago.</td>
|
||||
<td><a href="<?php echo site_url('spamadmin/session/' . $paste['session_id']) ?>">[<?php echo substr($paste['session_id'], 0, 8); ?>...]</a></td>
|
||||
<td><a href="<?php echo site_url('spamadmin/' . $paste['ip_address']) ?>"><?php echo $paste['ip_address']; ?></a></td>
|
||||
</tr>
|
||||
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
<?php } else { ?>
|
||||
<p>There have been no pastes :(</p>
|
||||
<?php }?>
|
@ -1,5 +1,5 @@
|
||||
<?php $this->load->view('defaults/header');?>
|
||||
<h1><a href="<?php echo site_url('spamadmin'); ?>">Spamadmin</a> - Pastes for sessionid <?php echo $session_id; ?></h1>
|
||||
<h1><a href="<?php echo site_url('spamadmin'); ?>">Spamadmin</a> - Pastes for ip <?php echo $ip_address; ?></h1>
|
||||
|
||||
<form action="" method="post">
|
||||
<label for="private">Block IP (<?php echo $ip_address; ?>)</label>
|
||||
@ -14,11 +14,11 @@
|
||||
|
||||
<div class="space"></div>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
function checkNum($num){
|
||||
return ($num%2) ? TRUE : FALSE;
|
||||
}
|
||||
$n = 0;
|
||||
$n = 0;
|
||||
if(!empty($pastes)){ ?>
|
||||
<table class="recent">
|
||||
<tbody>
|
||||
@ -35,7 +35,7 @@
|
||||
$eo = "odd";
|
||||
}
|
||||
$n++;
|
||||
?>
|
||||
?>
|
||||
|
||||
<tr class="<?php echo $eo; ?>">
|
||||
<td class="first"><a href="<?php echo site_url("view/".$paste['pid']); ?>"><?php echo $paste['title']; ?></a></td>
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
<?php } else { ?>
|
||||
<p>There have been no pastes :(</p>
|
||||
<?php }?>
|
Loading…
x
Reference in New Issue
Block a user