Welcome Guest, Not a member yet? Register   Sign In
valid-ip validation problem
#1

[eluser]MyBelovedPHP[/eluser]
I had trouble validating an ip-number while processing a post form in CodeIgniter 1.5.4.
My code in the controller named Scan:
Code:
$this->load->library('validation');
$rules['ip_adres']    = "trim|required|valid_ip";
$this->validation->set_rules($rules);
$fields['ip_adres'] = 'IP-adres';
$this->validation->run()
I got this error:
Fatal error: Call to undefined method Scan::valid_ip() in ../codeigniter/system/libraries/Validation.php on line 493

Validation.php line 493 is part of function valid_ip($ip):
Code:
return $this->CI->valid_ip($ip);
I had to change this to:
Code:
return $this->CI->input->valid_ip($ip);
Then it's working.
I use PHP 5 and CodeIgniter 1.5.4.
Anyone else these problems?

Cheers, Janghou
#2

[eluser]pr0digy[/eluser]
Yep, just ran into the same problem. What a convenient coincidence for me that you just solved this problem Smile
#3

[eluser]Michael Wales[/eluser]
Please submit a bug report so it can get fixed before the next version of CI is released.
#4

[eluser]pr0digy[/eluser]
Also, the error message for this validation rule is missing.
#5

[eluser]Michael Wales[/eluser]
Now that you say that... I almost seem to remember something about this...

Nevermind, I did a search - I was thinking of valid_url (this post).
#6

[eluser]MyBelovedPHP[/eluser]
Bug reported, also missing error message mentioned
#7

[eluser]Derek Allard[/eluser]
Fixed. Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB