Session Data Lost After One Page Refresh

I am using session data to store a "from page" while the user logs in ...

function setFromPage($url) {
  $this->session->set_userdata("from_page", $url);
function getFromPage() {
  return $this->session->userdata("from_page");    
function clearFromPage() {

From a restricted page (ie submission page) I do the following:


When I'm on the login page, at the top I have:

echo $this->libraryName->getFromPage();

It will echo the first time the page loads, but when I hit refresh the value goes away ...

I need it to stay until they login! Do I have to re-set it each time the page loads?

no one?


[eluser]Ruben Müller[/eluser]
What is your session config in "application/config/config.php"? Especially "sess_expiration"?

$config['sess_expiration'] = 7200;

I am using database based sessions. A lot of the data actually remains in the session such as the user info ...

It's just this one value that seems to get cleared ...

Quote:It’s just this one value that seems to get cleared ...

id say there is some code elsewhere in your app that clears it. search all the files in your app for "from_page", that would be a start.

db sessions, you mean this one? in that case you should be using $this->db_session->set_userdata . it works great for me. you could check your sessions table to see whats going on

If you monitor your sessions table in your database when you do a page refresh, do you get assigned a new session on ever page, or do you just have one session stored.

I renamed the var to "fromPage", taking out the underline, and still the same problem.

I used a 3rd party search (b/c windows sucks) to search for the clear method and didn't find it.

I will review the session table and try db_session ...

fyi for searching in files in Win you can use Notepad++ which can search in files of any folder you indicate, or Aptana which can search in files for any Project you create there. once you start working with large apps you'll want to use this Smile

good luck with db_session; i find it very useful since you get past the 4KB limitation of data that can be stored in cookies and its easy to set up.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.