Re: Sessions help needed !!!

From: Date: Sat, 18 Feb 2006 16:01:02 +0000
Subject: Re: Sessions help needed !!!
Groups: php.db 
Request: Send a blank email to php-db+get-41277@lists.php.net to get a copy of this message
At 22:19 17/02/2006, you wrote:
From: "Chris Payne" <chris@artistwd.com> To: <php-db@lists.php.net> Date: Fri, 17 Feb 2006 17:18:57 -0500 Message-ID: <000e01c63410$253c2ea0$6501a8c0@chris35bfl6odw> MIME-Version: 1.0 Content-Type: multipart/alternative;
        boundary="----=_NextPart_000_000F_01C633E6.3C6626A0"
Subject: Sessions help needed !!! Hi there everyone, OK this script worked perfectly on my own apache webserver and I had to move it to the main live server, but for some reason it's not passing session values in the same way and i'm positive it's something damn obvious. On my server I can use: echo $credits_system; echo $credits_left; echo $foldername;
Does it work if you ask for $_SESSION["credits_system"] etc ? The reason I ask is from the code above, you're using globally scoped variables, which would require you to be using either an old version of PHP on your test server, or have to manually enabled register_globals. Register globals is of course a major security risk in that it pollutes your variable namespace with whatever the user feels like sending to your server in $_GET, $_POST, $_COOKIE etc etc. So your code can be easily manipulated into undefined behaviours unless you declare and initialise every variable it uses.
To display the information to make sure it is being passed, but it returns blank on their server (Same versions of everything except I didn't install it so it may have something turned off in the config - which i don't have
I think you need to look at phpinfo() for that server. Check register_globals, it will be 'off'. Turn it 'off' on your test server so it mirrors the live environment and see if your code still works (it probably won't). The other check to make with the hosting company - I've only seen this once or twice on cheap hosting : See if they're using multiple servers. The session handler by default uses files, which are local to an individual server. If you visit the 'page' again, you may well be being server from another web server in a cluster. Of course that server knows nothing about the local session files on the server you initially got sent the page from, cause they're on another machines' filesystem, thus replicating your problem. The answer in that case is to register your own session handler (such as a DB) which resides on a known server.
control over, sigh). The thing is, the last one - $foldername I MUST have access to as the database uses this as a reference for searches and without
I don't understand what you mean by that, can you expand some more ? It's not clear how the database uses 'foldername' - is it concatenated as part of a query ?
this working I can't pull the data I need ($foldername is an ID and also refers to physical folders/directories on the apache webserver for video
If as noted above your host clusters servers, then you're SOL and will have to manage a central file repository or call across servers with fopen() etc to get at the [distributed] data in the "$foldername" path. Cheers - Neil

« previous php.db (#41277) next »