FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Limiting php file functions with .htaccess





cr3ativ3
Is there a way of limiting php's file functions to the directory's below the .htaccess.

Like say I have the .htaccess file in /public_html/.htaccess and I want a php file in /public_html/someuser/file.php to only be able to edit and open and delete files in /public_html/someuser/ and below and not /public_html/, as well as a php file in /public_html/someuser/includes/file.php would be able to modify files in /public_html/someuser/ and in directory's below that.

So a .htaccess file that does this. Hopefully that's not to confusing.

Oh and whoever can give me a working example get 50 frih$

Thanks,
Aaron
kv
I don't think it is possible to restrict a php file from accessing certain directories, but you can definitely restrict the user running the php script. But you have to keep in mind that the user running the script is a OS user and not the user of your application. If it is the OS user you are talking about, then there is no issue. Any (OS)user running the same script who does not have access will get an error. But if it is a user defined for your application (in some user table in a database or file of your application), then you will have to do the job yourself in the php script. htaccess will not be able to handle this (it does not even know what your OS users are).
qscomputing
cr3ativ3 wrote:
Is there a way of limiting php's file functions to the directory's below the .htaccess.

No, .htaccess controls what's accessible over HTTP through Apache. If you're wanting to restrict stuff running on your server then you need to use permissions: http://en.wikipedia.org/wiki/File_system_permissions

HTH.
AftershockVibe
I assume you want some sort of protection like the kind frihost has? I believe this is done on Apache by each user having his/her own virtual server (as specified in apache.conf) with a different documentRoot.

I've not done this myself but this is probably what you're looking for. Unless anyone knows otherwise?
Related topics
PHP function(); &file=""?
Cron jobs - running a php file
[PHP doubt]Knowing the directory location of PHP file
Gry mmorpg w przegladarce
is there any way to trigger a .php file without refreshing?
Uploading a .php file! NEED HELP thanks
User Viewing A PHP File
send variable from php tp php file
Server PHP file functions issues?
Remote php file access and reading
including javascript in php file
Hide PHP file extension
[TuT]JOOMLA Installation Guide(Easiest Way)
Two questions about the file ".htaccess"
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.