[eluser]Zorancho[/eluser]
Hi all.
I found this website where some of the guys from CodeIgniter is having a tutorial about protection using the session library.
His code was something like this:
Code:
class User extends Controller
{
function User
{
parent::Controller();
if($this->session->userdata('hash_string'))
{
$this->session->userdata(array('last_hash_string' => $this->session->userdata('hash_string')));
}
$this->load->helper('string');
$this->session->userdata(array('hash_string' => random_string('alnum', 6)));
}
And then he puts the hash_string from the session into a hidden input that he checks with the form_validation library if it is the same with the last_hash_string...
But when i try it i get this error:
Severity: Warning
Message: Illegal offset type in isset or empty
Filename: libraries/Session.php
Line Number: 422
And that line is:
Code:
function userdata($item)
{
return ( ! isset($this->userdata[$item])) ? FALSE : $this->userdata[$item];
}
If hash_string it's not isset then return false, otherwise it should return the value of it. But i don't get it why it doesn't see the given argument as valid.
Any ideas?
Thanks in advance