We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,996 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

need help password protecting a directory

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!

3
Contributors
4
Replies
5 Hours
Discussion Span
1 Year Ago
Last Updated
5
Views
webdi
Newbie Poster
16 posts since Jul 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 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.

diafol
Keep Smiling
Moderator
10,644 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,508
Skill Endorsements: 57

Thanks much.

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

webdi
Newbie Poster
16 posts since Jul 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 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.

diafol
Keep Smiling
Moderator
10,644 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,508
Skill Endorsements: 57

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

Stefano Mtangoo
Senior Poster
3,731 posts since Jun 2007
Reputation Points: 462
Solved Threads: 396
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0702 seconds using 2.71MB