Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » Return from help screens
Return from help screens [message #2059] Wed, 13 May 2009 07:08 Go to next message
gpatti is currently offline  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 #2060 is a reply to message #2059] Wed, 13 May 2009 08:49 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2368
Registered: April 2006
Location: Surrey, UK
Senior Member
I've tried this on my development PC and the demo system at http://www.radicore.org/demo.php and I cannot get it to fail.

If your debugger was able to fire up automatically at the start of each script (such as the Zend debugger which I use, part of Zend Studio) it would show what code was being executed in order to redirect it to the logon screen.

What browser are you using? What are your browser settngs?


Re: Return from help screens [message #2061 is a reply to message #2059] Wed, 13 May 2009 09:28 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
I'm using Internet Explorer 8. After you asked me I tried using Safari too. I get different results, but they are both wrong.

Using the menu system everything works perfectly in both browsers.

In my application using Safari:
I can go to a screen and toggle backwards and forwards between the screen and the help screen. When I then go to a different screen I am logged out.

In my application using IE8:
I can go to a screen and then to the help screen, but when I try and return to the app screen I am logged out.

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.

Which browser settings are you referring to?
Re: Return from help screens [message #2062 is a reply to message #2061] Wed, 13 May 2009 10:32 Go to previous messageGo to next message
AJM is currently offline  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?


Re: Return from help screens [message #2063 is a reply to message #2059] Wed, 13 May 2009 11:44 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
All the browser settings seem to be OK.

What I am seeing in the debugger is:
the correct script (the one I am expecting to be displayed on return from help) is calling initSession().

On line 598 of include.session.inc get instance is called: $session_obj =& singleton::getInstance('php_session');
This seems to be the cause of the problem because $_SESSION is null when returning from here.
Re: Return from help screens [message #2064 is a reply to message #2063] Wed, 13 May 2009 12:33 Go to previous messageGo to next message
AJM is currently offline  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.


Re: Return from help screens [message #2065 is a reply to message #2059] Wed, 13 May 2009 12:59 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
The session name is showing as menu0 in all the relevant places.

I don't see $_GET['session_id'], only $_GET['session_name'] which also says menu0.

$_REQUEST[menu0] has the correct value for session_id as per the audit database.
Re: Return from help screens [message #2066 is a reply to message #2065] Wed, 13 May 2009 13:11 Go to previous messageGo to next message
AJM is currently offline  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?


Re: Return from help screens [message #2067 is a reply to message #2059] Wed, 13 May 2009 13:48 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
session_start() is populating $_SESSION but I don't know how to tell whether it is the correct data or not.

The redirect to the logon screen is occurring due to the if statement at line 978:
if (basename($PHP_SELF) == 'help.php' OR is_True($GLOBALS['batch'])) {
this causes $script_id to be set to $logon_screen at line 996.

I'm not familiar with basename. What does this do?
Re: Return from help screens [message #2068 is a reply to message #2067] Wed, 13 May 2009 13:59 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2368
Registered: April 2006
Location: Surrey, UK
Senior Member
It looks like the $script_vars variable is empty, which it should not be. This is obtained from the $_SESSION array at line 632, so it looks like you have the wrong session data. What other values exist in the $_SESSION array?

For info on the basename() function take a look at http://uk3.php.net/manual/en/function.basename.php


Re: Return from help screens [message #2069 is a reply to message #2059] Wed, 13 May 2009 14:26 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
Unable to check at the moment. Will follow up on this later this evening.
Thanks.
Re: Return from help screens [message #2070 is a reply to message #2059] Wed, 13 May 2009 17:31 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
Yes, $script_vars is null.
This is because the condition at line 632
if (isset($_SESSION['pages'][$PHP_SELF]))
is evaluating to FALSE

I've attached a screen shot showing the contents of $_SESSION.
  • Attachment: debug.jpg
    (Size: 1.51MB, Downloaded 1622 times)
Re: Return from help screens [message #2071 is a reply to message #2059] Wed, 13 May 2009 18:16 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
Tony,

I've also noticed that when I look at the data being stored in session_data in the php_session table the amount of session data does not seem correct after I go to the help screen (as though not all the session data is being saved for the full stack of pages). [I don't really know what I'm talking about here though]. I was checking what the data looked like compared to using the menu application which seems to work correctly.

I then noticed the following, and I'm not sure whether it's related. In the menu app I click on the User List, then select a user to update. If I now visit the help page and then return, I go back to the list page rather than the user I was updating.

Not sure if this is a useful observation, or a red herring.

Re: Return from help screens [message #2072 is a reply to message #2070] Wed, 13 May 2009 18:24 Go to previous messageGo to next message
AJM is currently offline  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.


Re: Return from help screens [message #2073 is a reply to message #2071] Wed, 13 May 2009 18:35 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2368
Registered: April 2006
Location: Surrey, UK
Senior Member
I've just discovered that it's only happening when you run with client-side XSL transformations, but not server-side XSL transformations. At least I know where to look. It's now nearly midnight here, so I'll take a closer look in the morning.

Re: Return from help screens [message #2074 is a reply to message #2073] Thu, 14 May 2009 04:34 Go to previous messageGo to next message
AJM is currently offline  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


Re: Return from help screens [message #2075 is a reply to message #2059] Thu, 14 May 2009 05:08 Go to previous message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
Thanks Tony,
Tested and confirmed working correctly.
Graham
Previous Topic: Unsetting Action Buttons
Next Topic: problem extending a table class
Goto Forum:
  


Current Time: Sun Nov 24 14:26:03 EST 2024

Total time taken to generate the page: 0.02085 seconds