Question:

Password Protect Webpage BEFORE the *Index* Page Displays

by  |  earlier

0 LIKES UnLike

Just as my title states is what I want.

I needs to be very simple!

Thisis the one I've been using but it does NOT ask for the password BEFORE the Index page shows up.

--------------------------------------...

<script language="javascript">

<!--//

/*This Script allows people to enter by using a form that asks for a

UserID and Password*/

function pasuser(form) {

if (form.id.value=="0") {

if (form.pass.value=="0") {

location="place http: here"

} else {

alert("Invalid Password")

}

} else { alert("Invalid UserID")

}

}

//-->

</script>

<center>

<table bgcolor="white" cellpadding="12" border="1">

<tr><td colspan="2"><center><h1><i><b>Login

Area</b></i></h1></center></td></tr>

<tr><td><h1><i><b>UserID:</b></i></h1>... name="login"><input

name="id" type="text"></td></tr>

<tr><td><h1><i><b>Password:</b></i></h... name="pass"

type="password"></td></tr>

<tr><td><center><input type="button" value="Login"

onClick="pasuser(this.form)"></center>...

type="Reset"></form></td></tr></table>...

--------------------------------------...

If you can turn thisone in to what I am looking for OR can give me another SIMPLE one that will not allow the Index page to display BEFORE password is entered correctly is MUCH appreciated.

Also if you can make it soall I have to do is copy and paste would be very helpful to me.

I do select the "Best Answer" answer.

Thank you,

g111r

 Tags:

   Report

1 ANSWERS


  1. The only possible way to do this is place the above code in the index page and nothing else.

    Then put the URL of the second index page in the location=&quot;place http: here&quot;

    Then put everything else on the succeeding web pages: contents and all.

    With this configuration, when someone visits your site, the first thing they will see is the login page, and when they entered the right password details they can then view the contents.

    There are a lot of free scripts you could use to do this, I recommend that you visit the following:

    http://www.javascriptkit.com/script/scri...

    http://www.codetoad.com/javascript_login...

    http://javascript.internet.com/passwords...

    http://www.js-x.com/page/asp__login.html

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.