...

View Full Version : Authentication



PenguinJr
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 =).

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

example:



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
}
else
{
die('invalid user name');
}

PenguinJr
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 =)

firepages
03-24-2004, 03:48 PM
assuming $user is authenticated at this point
<?php
if(file_exists($user.'/index.php')){
header("location: $user/index.php");
exit();
}
?>

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum