must be valid ip

This commit is contained in:
Claude 2012-06-14 15:36:53 +02:00
parent 500b05cc7e
commit 0116204a40

View File

@ -16,6 +16,7 @@
* - captcha()
* - _valid_lang()
* - _valid_captcha()
* - _valid_ip()
* - get_cm_js()
* - error_404()
* Classes list:
@ -255,6 +256,11 @@ class Main extends CI_Controller
'label' => 'Captcha',
'rules' => 'callback__valid_captcha',
) ,
array(
'field' => 'valid_ip',
'label' => 'Valid IP',
'rules' => 'callback__valid_ip',
) ,
);
//form validation
@ -476,6 +482,15 @@ class Main extends CI_Controller
}
}
function _valid_ip()
{
$this->form_validation->set_message('_valid_ip', 'You are not allowed to paste.');
$query = $this->db->get_where('blocked_ips', array(
'ip_address' => $this->input->ip_address()
) , 1);
return count($query->result_array()) == 0;
}
function get_cm_js()
{
$lang = $this->uri->segment(3);