Welcome Guest, Not a member yet? Register   Sign In
Weird Session Problem
#1

[eluser]mdavis1982[/eluser]
Hi all...

I'm having some really weird session problems that I just can't figure out!

In my code I do:

Code:
function myFunction($param1 = NULL, $param2 = NULL)
{
    echo $param2; // Prints out 'h'
    $this->session->set_userdata('myparam', $param2);
    echo $this->session->userdata('myparam'); // Prints out 'h'
}

This seems to work fine, but when I come to echoing the session variable out later on in my site, I find that it's suddenly changed itself to 'public', instead of the value of $param2.

If I change the set_userdata line above to $param1, it works flawlessly.

Has anyone got some ideas?

Cheers...

Matt
#2

[eluser]mdavis1982[/eluser]
Hi Guys...

Has anyone got any ideas about this?

It seems to only happen with the $param2 variable...

If I go to http://localhost/controller/myfunction/param1/h, then the site echoes out the correct things...

If later on I have:

Code:
function myFunction2()
{
    echo $this->session->userdata('myparam');
}

Then it prints out 'public', instead of 'h'.

I've checked everywhere and the session variable has not been set again... I've also tried using the CI session library and RA_Session from the Wiki, but both do the same thing.

Does anyone have any ideas?

Cheers...

Matt
#3

[eluser]dmiden[/eluser]
Well, try a clean-install and just do the myparam thingy. If it still returns 'public' it's prolly hardcoded into CI.
Otherwise it _do_ seem like you're/ your script is setting it elsewhere. Double check, and if you're unsuccessful, just use another name for the session item.




Theme © iAndrew 2016 - Forum software by © MyBB