On Sunday 28 November 2004 05:46 pm, steve wrote: > Jason Wong wrote: > > On Sunday 28 November 2004 22:46, steve wrote: > >> I tried printing out the values before and after each of those lines. > >> After line 53, $ref_page is an array containing precisely the values I > >> expect, so the function is working. After line 54, the session var has > >> been reset, as expected, to match the current page - but $ref_page has > >> also changed and is now equal to $_SESSION['ref_page'], which is what I > >> found very weird - ie, resetting $_SESSION['ref_page'] simultaneously > >> reset $ref_page. > > > > Is $ref_page getting set to what the _previous_ value of > > $_SESSION['ref_page'] was? If so, it sounds like you have > > register_globals enabled. > > No to both. When I arrive at the new page, the sessions vars (as expected) > contain the values set by the previous page. $ref_page is not set. The > values are transferred to $ref_page by the function. That works as planned. > I then reset the value of the session vars, at which point, $ref_page also > gets set. From printing out the values after each line, I find this: > > Let's say we've come from the page /community.php and have arrived > at /market.php. Here are the values at each stage: > > $_SESSION['ref_page] = '/community.php' > $_SESSION['ref_pagequery'] = 'pagemode=index' // as an example > 53. $ref_page = get_ref_page(); > $ref_page['name'] = '/community.php' > $ref_page['query'] = 'pagemode=index' > $_SESSION['ref_page] = '/community.php' > $_SESSION['ref_pagequery'] = 'pagemode=index' > 54. $_SESSION['ref_page'] = THIS_PAGE; > $ref_page = '/community.php' // now a scalar > $_SESSION['ref_page] = '/market.php' > > register_globals is off (in php.ini and there are no .htaccess files). > > -- > @+ > Steve
Hi Steve, As a late-comer to this thread, I'd like to toss about a few ideas. I gather that all of the script occurs on one page, and that the page is 'refreshed' by some action of the user (i.e. that the user has clicked/entered login info on some other page, and that this page then needs to detect that change.) What may be happening is that the refresh action triggers the script twice: once for the initial loading and again for the reset values. Hence, $ref_page gets reset by line 53 ($ref_page = get_ref_page(); I experienced the same difficulty once, and essentially solved the problem by adding an extra page that is called, by a simple switch statement, if there is a change: i.e, from 'community' to 'market'. Another question, by any chance, are you switching into https by any chance? Hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php