using $_session to code file locations?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lsalsich
Forum Newbie
Posts: 2
Joined: Fri Jun 24, 2005 3:00 pm

using $_session to code file locations?

Post by lsalsich »

Hey all,

I'm a fairly experienced PHP developer, but I have a project that I am designing that has some unique needs (don't they all!):

1) I need to create new copies of a CMS site and mysql database (using Mambo for now) upon the submission of a secure web-form. (I have this part completed)

2) I need to use one code-base for the CMS, with each new CMS site using this code-base to run. This is crucial since I want to make updates and changes to the code-base only once.

3) I need to allow each CMS site to have unique settings like template, plugins, etc.

ok, I have most of this coded and working, but I am using $_SESSION['configuration.php] to tell each CMS site where to locate the configuration.php file. This is what I would like feedback on, if possible.

Right now, the way the code works is that when a user goes to http://www.example_stite/sites/cms1/ they will start a session indicating that the CMS configuration file for 'sites/cms1' is the absolute path to 'sites/cms1/configuration.php'. The user is then routed to the main CMS code-base that has been edited slightly to use the configuration.php as $_SESSION['configuration.php', rather than the stock location.

Alternatively, if a user goes to http://example_site/sites/cms2 they will start a session indicating that the CMS configuration file for is the absolute path to 'sites/cms2/configuration.php'..... etc.

This actually functions well (in a development environment) so far. But, I wanted to ask other PHP users if using $_SESSION in this way poses any obvious weaknesses or security threats, etc.

Thanks in advance for your thoughts.

Luke
User avatar
dethron
Forum Contributor
Posts: 370
Joined: Sat Apr 27, 2002 11:39 am
Location: Istanbul

Post by dethron »

it seems no, but i have to think about it
Post Reply