PDA

View Full Version : Simple Password Protection


zakfox1986
01-27-2005, 07:31 AM
Note to Admin: I wasn't exactly sure where to post this, I'm sorry if it's in the wrong place.

Greetings!

I am wanting to know what's the simplest way to password protect a site. The site that I need to protect is one I'm doing for a family so that they can have family recipes, a list of family members contact info, etc. so it's not it doesn't have to be extremely secure. What is the simplest route to go about doing this? .htaccess, php, javascript? what? Could anyone reccomend any tutorials or something? Any ideasa would be MUCH appreciated!

Thanks in advance!

Zak

Cool-August
01-27-2005, 05:06 PM
Here is one, I don't know really how secure it is, but I can't think of a way around it, there is a catch to the code though; what ever your password is you have to name your page the same thing, depending on the different pages you have, more than one password will work and they would take you to different places, It's nice when you don't want to deal with User Names!

<form action="" onsubmit="location.href = this.elements[0].value + '.html'; return false;">
<input type="text">
<input type="submit" value="Submit">
</form>

Oh, I almost forgot, if the password that is typed in is incorrect, A cannot be displayed page will come up, that is unless you have a 404 page.

Cool-August
01-27-2005, 05:18 PM
Here is another one I found.
It is very easy to hack though.

<script language="JavaScript">
<!--hide
var password;
var pass1="PUT-PASSWORD-HERE";
password=prompt(Please Type in your password',' ');
if (password==pass1)
window.location="PAGE-HERE-IF-RIGHT-PASSWORD.HTML";
else
{
window.location="PAGE-HERE-IF-WRONG-PASSWORD.HTML";
}
//-->
</script>

zakfox1986
01-27-2005, 05:31 PM
Thanks a ton, Cool-August! I really appreciate you taking the time to mention these! I have decided (since posting the request for info) to go with the .htaccess method. I know it's not the "prettiest" and most professional method but, it works and it's simple. I'll file away your suggestions, though! I may use them in the future!

Thanks again!

Zak