How can I password protect this page?

N

Narlen

Hi there

I would like to password protect (or "directory listing denied") my website.
I am using the following code. The problem is that if people choose "view
page source" in any web browser it shows the password. Can anyone give me a
code that would hide the password? Thanks a lot for your help.

Here is the code:

<script language="javascript">
<!--//

function pasuser(form) {
if (form.pass.value=="michael2") {
location="index2.html"
} else {
alert("Invalid Password")
}
}
//-->
</script>



<tr><td><h1><i><b>Password:</b></i></h1></td><td><form name="login"><input
name="pass"
type="password"></td></tr>
<tr><td><input type="button" value="Login"
onClick="pasuser(this.form)"></td><td><br>
 
?

=?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=

Narlen said:
Hi there

I would like to password protect (or "directory listing denied") my
website. I am using the following code. The problem is that if
people choose "view page source" in any web browser it shows the
password. Can anyone give me a code that would hide the password?
Thanks a lot for your help.

Here is the code:

[snip JavaScript code]

JavaScript is at best flaky, and fairly easy to bypass.

I don't know what web server software your website runs on, but here's
a quick tutorial on how to password protect directories in Apache:
http://www.javascriptkit.com/howto/htaccess3.shtml

(Don't be fooled by the domain name, this particular tutorial doesn't
include any JavaScript code.)
 
N

Narlen

Thanks for all your suggestions. With all respect, I need more help. I spend
the whole night tring to make it work. I don't know what javascript is but
plain html will do it. Maybe someone could post suitable html code. I would
really appreciate it. (It's an apache server (macintosh powerbook)).

Thank you much
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top