Tutorial :Http authentication change working directory


What I would like to do is for my users to log in with http authentication. Based on their login username the working directory will be different.

I need to use http authentication because I don't want to interfere with the web application (drupal) that is in the users working directories.

I also don't the users to have access to the other users files.

What I visualize is a user loging in with http authentication, we will look up the username in my MySQL database and find out what their working directory should be. What will end up happening is that all user's urls will be the same (http://myhost/index.php) but they all will be accessing a different index.php.

I am comfortable with the php stuff. The thing that has me stumped is dynamically changing the working directory.


I would seriously consider giving them each a subdomain, and/or using something like mod_vhost_alias. However, a rewiterule with appending %{REMOTE_USER} (you are using http authentication after all) should do most of the work.



bool chdir (string $directory)

Changes PHP's current directory to $directory.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »