Return from help screens [message #2059] |
Wed, 13 May 2009 07:08 |
gpatti
Messages: 283 Registered: August 2008
|
Senior Member |
|
|
Tony,
I'm having a problem on returning from help screens within my app. When I use the browser's back button to return from a help screen I am being logged out of the application (I get a logoff screen prompting me to log back in).
When I use your apps (e.g. the menu app) it works fine.
Debugging isn't helping at the moment as the debugger completes its activity once the help screen is displayed. The problem then occurs pressing the browser's back button. It's obviously something I have done, but don't know where to start looking. Can you give me some pointers?
|
|
|
|
|
Re: Return from help screens [message #2062 is a reply to message #2061] |
Wed, 13 May 2009 10:32 |
AJM
Messages: 2368 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
By browser settings I mean such things as the options for dealing with browser history. In IE6/7 (I have not used IE8 yet) go to Tools->Internet Options->Browsing History Settings where you will see "Check for newer versions of stored pages" which I have set to "automatically".
In both IE7 and Safari I can go to a help page, then toggle back and forth between the original page and the help page as many times as I like without any problem.
When you say "I got a bit further with the debugger but wasn't able to follow your code with reference to session initialisation to determine where it is going wrong" what exactly do you mean? Did the correct script enter the initSession() function before it was kicked out to the logon screen? If so then step through the initSession() function with your debugger to see the reason why it was kicked out. It is usually because the $_SESSION array is empty, which is usually because the URL does not identify the correct session name, or the session data has been deleted.
If using the help screens in the MENU subsystem is OK could it be that the help.php script in your application subsystem is not the same?
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: Return from help screens [message #2064 is a reply to message #2063] |
Wed, 13 May 2009 12:33 |
AJM
Messages: 2368 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Line 598 $session_obj =& singleton::getInstance('php_session'); is simply instantiating an object from the php_session class, so $_SESSION will remain empty until the following call to session_start().
What is the value in $session_name?
What is the value in $_GET['session_id']?
These two values should point to an existing session_id. Is it the correct id? Does that session data still exist? If your session handler is the database (which it should be by default) then look in the php_session table of the AUDIT database.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: Return from help screens [message #2066 is a reply to message #2065] |
Wed, 13 May 2009 13:11 |
AJM
Messages: 2368 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
If the value for session_id points to an entry in the php_session table then that should populate the $_SESSION array with all the values from the previous script, so there should be no reason why the script gets kicked out to the logon screen.
What happens after the call to session_start() at line 609? oes it populate the $_SESSION array with data as expected?
What condition causes the redirect to the logon screen?
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
|
|
|
|
Re: Return from help screens [message #2072 is a reply to message #2070] |
Wed, 13 May 2009 18:24 |
AJM
Messages: 2368 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
That's very peculiar as the $_SESSION['pages'] array shows only 2 entries:
- /menu/logon.php
- /menu/menu.php
So where's the application script that you were running when you pressed the HELP hyperlink?
The $_SESSION['page_stack'] array also looks empty when it shouldn't be.
Something is happening to the contents of $_SESSION when you press the HELP hyperlink as it appears to be clearing out the values for the script which you were running, so when it returns it cannot find its values. I cannot reproduce this problem at all at my end, so you will have to step through line by line with your debugger to see exactly where $_SESSION['pages'][<script_id>] and $_SESSION['page_stack'][<task_id>] are being cleared.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: Return from help screens [message #2074 is a reply to message #2073] |
Thu, 14 May 2009 04:34 |
AJM
Messages: 2368 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Here's the fix:
In file 'include.session.inc' at line 1028 change
if (isset($_SESSION['page_stack'])) {
// remove any redundant entries in $_SESSION['page_stack']
$_SESSION['page_stack'] = comparePageStacks($_SESSION['page_stack'], $page_stack);
} // if to
if (isset($_SESSION['page_stack'])) {
if (basename($PHP_SELF) == 'help.php') {
// continue
} else {
// remove any redundant entries in $_SESSION['page_stack']
$_SESSION['page_stack'] = comparePageStacks($_SESSION['page_stack'], $page_stack);
} // if
} // if
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|