mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-28 22:41:07 -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/rss'] = 'main/lists/rss';
|
||||||
$route['lists/:num'] = 'main/lists/$1';
|
$route['lists/:num'] = 'main/lists/$1';
|
||||||
$route['spamadmin/:num'] = 'spamadmin/index';
|
$route['spamadmin/:num'] = 'spamadmin/index';
|
||||||
$route['spamadmin/session/:any'] = 'spamadmin/session';
|
$route['spamadmin/:any'] = 'spamadmin/spam_detail';
|
||||||
$route['about'] = 'main/about';
|
$route['about'] = 'main/about';
|
||||||
|
|
||||||
$route['iphone/:num'] = 'iphone';
|
$route['iphone/:num'] = 'iphone';
|
||||||
|
@ -152,8 +152,6 @@ class Main extends CI_Controller
|
|||||||
$this->dbforge->create_table('blocked_ips', true);
|
$this->dbforge->create_table('blocked_ips', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if field session_id exists
|
|
||||||
|
|
||||||
if (!$this->db->field_exists('ip_address', 'pastes'))
|
if (!$this->db->field_exists('ip_address', 'pastes'))
|
||||||
{
|
{
|
||||||
$this->load->dbforge();
|
$this->load->dbforge();
|
||||||
|
@ -32,28 +32,17 @@ class Spamadmin extends CI_Controller
|
|||||||
{
|
{
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$data = $this->pastes->getSpamLists();
|
$data = $this->pastes->getSpamLists();
|
||||||
$this->load->view('spamlist', $data);
|
$this->load->view('list_ips', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function session()
|
function spam_detail()
|
||||||
{
|
{
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
|
$ip_address = $this->uri->segment(2);
|
||||||
|
|
||||||
//sessionid
|
if ($this->input->post('confirm_remove') && $ip_address != '')
|
||||||
$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
|
|
||||||
|
|
||||||
if ($this->input->post('confirm_remove') && $session_id != '')
|
|
||||||
{
|
{
|
||||||
$this->db->where('session_id', $session_id);
|
$this->db->where('ip_address', $ip_address);
|
||||||
$this->db->delete('pastes');
|
$this->db->delete('pastes');
|
||||||
|
|
||||||
if ($this->input->post('block_ip'))
|
if ($this->input->post('block_ip'))
|
||||||
@ -65,11 +54,10 @@ class Spamadmin extends CI_Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
//fill data
|
//fill data
|
||||||
$data = $this->pastes->getSpamLists('spamadmin/session/' . $session_id, $seg = 4, $session_id);
|
$data = $this->pastes->getSpamLists('spamadmin/' . $ip_address, $seg = 3, $ip_address);
|
||||||
$data['session_id'] = $session_id;
|
|
||||||
$data['ip_address'] = $ip_address;
|
$data['ip_address'] = $ip_address;
|
||||||
|
|
||||||
//view
|
//view
|
||||||
$this->load->view('list_sessionid', $data);
|
$this->load->view('spam_detail', $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,13 +24,13 @@ class Pastes extends CI_Model
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
function countPastes($session_id = false)
|
function countPastes($ip_address = false)
|
||||||
{
|
{
|
||||||
$this->db->where('private', 0);
|
$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');
|
$query = $this->db->get('pastes');
|
||||||
return $query->num_rows();
|
return $query->num_rows();
|
||||||
@ -372,7 +372,7 @@ class Pastes extends CI_Model
|
|||||||
return $data;
|
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('pagination');
|
||||||
$this->load->library('process');
|
$this->load->library('process');
|
||||||
@ -386,12 +386,12 @@ class Pastes extends CI_Model
|
|||||||
{
|
{
|
||||||
$page = $this->uri->segment($seg);
|
$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);
|
$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');
|
$this->db->order_by('created', 'desc');
|
||||||
$query = $this->db->get('pastes', $amount, $page);
|
$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]['created'] = $row['created'];
|
||||||
$data['pastes'][$n]['lang'] = $row['lang'];
|
$data['pastes'][$n]['lang'] = $row['lang'];
|
||||||
$data['pastes'][$n]['pid'] = $row['pid'];
|
$data['pastes'][$n]['pid'] = $row['pid'];
|
||||||
$data['pastes'][$n]['session_id'] = $row['session_id'];
|
$data['pastes'][$n]['ip_address'] = $row['ip_address'];
|
||||||
$n++;
|
$n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$config['base_url'] = site_url($root);
|
$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['per_page'] = $amount;
|
||||||
$config['num_links'] = 9;
|
$config['num_links'] = 9;
|
||||||
$config['full_tag_open'] = '<div class="pages">';
|
$config['full_tag_open'] = '<div class="pages">';
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<th class="name">Name</th>
|
<th class="name">Name</th>
|
||||||
<th class="lang">Language</th>
|
<th class="lang">Language</th>
|
||||||
<th class="time">When</th>
|
<th class="time">When</th>
|
||||||
<th class="time">Session</th>
|
<th class="time">IP</th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php foreach($pastes as $paste) {
|
<?php foreach($pastes as $paste) {
|
||||||
if(checkNum($n) == TRUE) {
|
if(checkNum($n) == TRUE) {
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<td><?php echo $paste['name']; ?></td>
|
<td><?php echo $paste['name']; ?></td>
|
||||||
<td><?php echo $paste['lang']; ?></td>
|
<td><?php echo $paste['lang']; ?></td>
|
||||||
<td><?php $p = explode(",", timespan($paste['created'], time())); echo $p[0]; ?> ago.</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>
|
</tr>
|
||||||
|
|
||||||
<?php }?>
|
<?php }?>
|
@ -1,5 +1,5 @@
|
|||||||
<?php $this->load->view('defaults/header');?>
|
<?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">
|
<form action="" method="post">
|
||||||
<label for="private">Block IP (<?php echo $ip_address; ?>)</label>
|
<label for="private">Block IP (<?php echo $ip_address; ?>)</label>
|
Loading…
x
Reference in New Issue
Block a user