From 0116204a40f60db1158597449aca4fc28173d88d Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 14 Jun 2012 15:36:53 +0200 Subject: [PATCH] must be valid ip --- htdocs/application/controllers/main.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/htdocs/application/controllers/main.php b/htdocs/application/controllers/main.php index cdc8268..519a9b7 100755 --- a/htdocs/application/controllers/main.php +++ b/htdocs/application/controllers/main.php @@ -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);