CodeIgniter Forums
Inconsistent Session Data - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Inconsistent Session Data (/showthread.php?tid=12320)



Inconsistent Session Data - El Forum - 10-14-2008

[eluser]Unknown[/eluser]
Hi All,

I have an inconsistent session data case. In my code, I generate some random md5 has value, and pass it to both a session variable and also pass it as a value in my hidden control.

Code:
$this->load->library('session');

$this->data["somevalue"] = md5(rand(8999,19999));

$newdata = array(
           'sessionpass' => $this->data["somevalue"]
       );

$this->session->set_userdata($newdata);

For example, the value generated is 043ea4eb48d314b91e95fb5052d3d8f0. And when I submit the page again I've got different value.

Code:
echo $_POST["sessionpassval"]; //this is input hidden field, got 043ea4eb48d314b91e95fb5052d3d8f0
echo $this->session->userdata("sessionpass"); //returns  665a24a314ec348b3b2ac1e3eb26dae0

Is there any explanation on this ?

Thanks,

JarBis