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!

Member Avatar for diafol
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.

Thanks much.

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

Member Avatar for diafol

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.