1.11M Members

need help password protecting a directory

 
0
 

Hi,

I've not been successful looking for a solution to my problem.

What I need is to password protect a directory. I could use htaccess, but the user doesn't want a pop-up login window. He wants to start on a page with a form with the username and password fields. Once the proper login credentials are entered, then access is granted to everything in the protected directory.

Can anyone link me to instructions on how to do this?

Thanks much for your help!

 
0
 
session_start();
if(!isset($_SESSION['passok']))header("Location:pass.php");

at head of files in this folder. pass page gets input - if ok set session variable.

 
0
 

Thanks much.

So then, on my login page how do I set the passok?

 
0
 

your pw form sends data to a form handler page which sets the session variable then redirect to the default page in the protected folder if pass matches the expected pw. if no match redirect to the pw form again with an error msg.

 
0
 

Hi,

I've not been successful looking for a solution to my problem.

What I need is to password protect a directory. I could use htaccess, but the user doesn't want a pop-up login window. He wants to start on a page with a form with the username and password fields. Once the proper login credentials are entered, then access is granted to everything in the protected directory.

Can anyone link me to instructions on how to do this?

Thanks much for your help!

http://www.devarticles.com/c/a/PHP/PHP-for-Beginners-by-a-Beginners/
http://www.sitepoint.com/anthology-2-1-access-control/
http://www.sitepoint.com/forums/php-34/php-login-redirect-logout-script-732382.html

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: