0

I'm trying to get a session to pass from page to page while using eval(). Basically I have one page that handles all other requests and just gets the pages output via an eval() call.

Everything works fine, but for some reason the session information keeps resetting on every refresh. The login system, which also uses sessions, doesn't reset with every page refresh, though.

If you go to http://fretfast.com and view the source code, you can see the contents of $_SESSION starting on line 221.

My question is, how does the login system still work but the other session information keeps getting reset? The firstActivity and lastActivity variables are set on the configuration page that is included on the main file which handles all requests. These only get set if a session has not already been started, like so:

if ( session_id() == '' ) {
    session_start();
    // set other $_SESSION['trail'] variables
}

The requests and requestTimes variables are set inside the object that retrieves a given page's contents via eval().

If anyone has any idea what the problem may be or needs any information I would be glad to provide it. Thanks in advance.

SISYN
  • 2,209
  • 5
  • 24
  • 45

1 Answers1

1

Your check never evaluates to true, so the session_start() never executes. Unless you specifically changed (or emptied) the session id (either by code or in your php.ini), it defaults to PHPSESSID (and a quick firebug check to your url confirms that).

Skip the check altogether, and just issue the session_start() at the beginning of your file.

P.S. Why do you use eval() ? NEVER use eval() !

Anastis
  • 256
  • 1
  • 3
  • Honestly because I can't think of another practical work-around. I don't exactly want to go into detail about how the system works in an open discussion, but I would very much appreciate it if you sent me an email through my website http://mdl.fm so that I could explain it to you and get your constructive criticism or suggestions/advice. Thanks! – SISYN Apr 27 '13 at 18:27