View Full Version : Authentication

03-24-2004, 11:02 AM
Hi guys,

I have a question.

I'm thinking of creating a folder called 'client', which have several other folders based on usernames. These other folders will be password protected through their own .htaccess and .htpassword files
And in this client folder, i'll have an index page. In this index page there'll be a form asking for the username.

My question is, how do I make it so that when they submit that username they'll be taken to their own respective folder (so www.domain.com/client/username) and a pop-up that appears because of the .htaccess will have their username typed in automatically?

Or is there another approach to this?

I'm open to any suggestions.

All help will be greatly appreciated.

Thank you =).

03-24-2004, 12:09 PM
surley you could just use a simple IF/THEN/ELSE loop?


if ($user=="penguinjr")
include('penguin/index.php'); #path for penguinjr's folder
elseif ($user=="sweenster")
include('sweenster/index.php'); #path for sweenster's folder
elseif ($user=="abcd")
include('abcd/index.php'); #path for abcd's folder
die('invalid user name');

03-24-2004, 12:45 PM
That works fine.. for small number of users.

What if there are 100 of clients? or even more?

And does that automatically fill in the 'username' field for the authentication pop-up?

I'd need something more flexible...

Thanx anywayz =)

03-24-2004, 03:48 PM
assuming $user is authenticated at this point
header("location: $user/index.php");

03-25-2004, 12:10 AM
thanx for the help guys =).