Jump to content

stop access outside a folder


DJCMBear

Recommended Posts

Hi im trying to create an application section to my site, but I dont want the application developer to be able to require a file outside their folder when they require or include a file in their folder.

 

So if a user created an application and created a file and put require('../index.php'); in the root dir and lets say that went to the main sites home i would want an error to show saying you cant require a page outside their root dir and not show that page.

 

The file system would be like the index.php page which holds the codes that will show the application, and a folder called app-files and in the app-files folder it would have a folder for each app so if there was an app called free-codes the the path to that app would be '/app-files/free-codes/[path-to-files-user-has-creaded]' etc.

 

So basicly the users app folder inside the app-files folder would be their base dir and you can't access anything outside that.

 

If anyone knows of anyway I could do this please reply, Thank You.

Link to comment
Share on other sites

Thanks for the replys they are helpfull however im not using my own server and my server wont do something for just one user so i cant go through the server, I was thinking about .htaccess cus i use them files alot but i dont know if/how i could write something in that to let the server think thats the root folder and from what i know you cant access anything outside the root without telling your server that which mine hasnt.

 

If someone knows a php or .htaccess code/function how i can do this then please feel free to tell me, thank you.

Link to comment
Share on other sites

I was just wondering if i used .ht to make the server think the folder its in is the root of the site would PHP requests such as require and include still allow users to include pages outside the folder or because the server thinks the folder is the root then they will not include pages outside that folder?

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.