Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Password protected directory-Script

Quote Reply
Password protected directory-Script
Hello, I rencently found this Java script to password protect a page. Could this be use with the Links Manager ? If so, it says to insert it at the top of the page where you want to have password protection...? What page should that be ? and would it work ?

Here is the script and instructions that came with it->

Set up multiple username and passwords for members:

Add the code to your "enter" page, if they get it wrong, they stay, if they get it right, they can go it. You can set up multiple username and password in the script, like a member list.

Example:

Click here to run the script
The user name is: user1
The password is: pass1
If you type the incorrect login it will redirect you back here

The Code

Just copy and paste this script after the <HEAD> tag of your page:

<script language="JavaScript">
// More scripts at http://www.java-scripts.com

<!--
//Reaplace correct.html to whatever page you wan't them to access.
var goodURL = "correct.html"

alert("To access the following document, you must pass a "
+"members-only, authorization test.\n \n At the appropriate "
+"time, enter in your username and password.")

var username = prompt("Enter in your username","")
var password = prompt("Enter in your password","")

if (username == null &#0124; &#0124; password == null) {

alert("Authenification failed!!!")
history.back();
}

else {
var combo = username + password
var total = combo.toLowerCase()

//Edit these to your own usernames and passwords.
if (total == "user1pass1" &#0124; &#0124; total == "user2pass2" &#0124; &#0124; total == "user3pass3") {

alert("You passed authenification! Come right in")
location = goodURL
}
else {
alert("Authenification failed!!!")
history.back();
}
}
//-->
</script>




------------------
P.Espinoza
Qdice.com
Subject Author Views Date
Thread Password protected directory-Script qdice 1193 Dec 23, 1999, 6:16 PM
Post Re: Password protected directory-Script
Eliot 1117 Dec 27, 1999, 2:33 PM