On Tuesday 01 July 2003 12:46, John Manko wrote: > Hello everyone. I was able to determine what was causing my problem > with session variables not being persitant across page requests. I want > to give you the full scope here, so I'm going to paste the code (and if > you have any code tips, please let me know). > I think the problem might be this (and I don't know why it should be, > but maybe you can help): > If you look at file2.php, you will see that ValidAdminLogin() contains > the "global $_SESSION;" declaration., but that's not the problem. > ValidAdminLogin() calls a function ResetSessionVariables(), which also > contains "global $_SESSION;". When "global $_SESSION;" is present in > ResetSessionVariables(), it seems as though the $_SESSION variables are > not being preserved across page requests (notice that > ResetSessionVariables() is called BEFORE the variables are set with the > real data, but it's really $_SESSION['uid'] we are concerned with.) > When I remove "global $_SESSION;" from ResetSessionVariables(), all > works fine across page request. Also note that $_SESSION['uid'] is set > when we return from the file2.php function calls as noted in the "echo" > command. So, why would a double global definintion negate $_SESSION?
I've not looked at your code but the fact is that "global $_SESSION;" is completely unnecessary. $_SESSION is a 'superglobal' that is available in all scopes. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* Marxist Law of Distribution of Wealth: Shortages will be divided equally among the peasants. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php