Jump to content

Restrict PHP files to respective User folder


Recommended Posts

Hi, I was wondering how I would go about stopping PHP files from altering things outside of it's directory.

Say [user X] creates a PHP script that script automatically saves to [user X]'s folder located within Localhost/Users/ where all user folders are located.

But none of [user X's] files can access access any folder above it's own.

 

How would I be able to specify this in PHP or the PHP.ini?

 

Example

 

Things like "$fp=fopen($_SERVER['DOCUMENT_ROOT'] ."/Users");" would be bad.

 

Thankyou,

GB.

Link to comment
Share on other sites

Then you don't really have enough control over the configuration. You could set this via a .htaccess, though there would be nothing stopping a user from editing the .htaccess file.

 

How would I be able to do it via .htaccess?

Also users would only be able to edit their PHP files via editor I provide them so I don't think they'd be able to edit the .htaccess.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.