Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP

Password Protected

Hello. I would like to learn how to create a page that is password protected only (no user login necessary). I could not find this anywhere so I am assuming it is a new topic to this forum. I'd appreciate the help in creating this script/code. Thank you.

3 Answers

I don't recall there being a video for that on Treehouse... I could be wrong. Your best bet is getting an Admin to help you out. They will probably know were those instructions are. Good luck! :)

Thank you. I will do that! :)

Elliott Frazier
PLUS
Elliott Frazier
Courses Plus Student 9,647 Points

What will you be using it for? If your looking for something easy and not that fancy, a .htaccess script might be what your looking for.

I've developed a website for my current job and need to password protect a page that is intended for customers only. I've read that PHP is the best way to go in comparison to any javascript. I have not heard of .htaccess. My ultimate goal is to have a code or script that will password protect a page without the ability to bypass the password by viewing source in a browser.

Elliott Frazier
PLUS
Elliott Frazier
Courses Plus Student 9,647 Points

What you would probably want to do is store your customer's passwords and/or IDs in a database so you can update and remove them easily. then use PHP on your sign-in page to check if the password and/or username entered matches one that is stored in the database.