ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-db
php-db
[PHP-DB] Re: Sessions help needed !!!
by Neil Smith [MVP other posts by this author
Feb 18 2006 8:09AM messages near this date
Re: [PHP-DB] apostrophes everywhere | [PHP-DB] Found the sessions solution :-)
At 22:19 17/02/2006, you wrote:
> From: "Chris Payne" <chris@[...].com>
> To: <php-db@[...].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  

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved