Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.