How can I password protect this page?

Discussion in 'HTML' started by Narlen, Nov 1, 2005.

  1. Narlen

    Narlen Guest

    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>
     
    Narlen, Nov 1, 2005
    #1
    1. Advertising

  2. Narlen wrote:

    > 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.)

    --
    Kim André Akerø
    -
    (remove NOSPAM to contact me directly)
     
    =?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=, Nov 1, 2005
    #2
    1. Advertising

  3. Narlen

    PeterMcC Guest

    Narlen wrote in
    <BF8C6874.14E5C%>

    > Hi there
    >
    > I would like to password protect (or "directory listing denied") my
    > website.


    <snip>

    How about .htaccess? It's server-side and so more secure than client-side -
    and it's dead easy.

    http://www.javascriptkit.com/howto/htaccess3.shtml


    --
    PeterMcC
    If you feel that any of the above is incorrect,
    inappropriate or offensive in any way,
    please ignore it and accept my apologies.
     
    PeterMcC, Nov 1, 2005
    #3
  4. Narlen

    Narlen Guest

    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


    On 11/1/05 12:51 AM, in article
    43672c89$0$63063$, "PeterMcC"
    <> wrote:

    > Narlen wrote in
    > <BF8C6874.14E5C%>
    >
    >> Hi there
    >>
    >> I would like to password protect (or "directory listing denied") my
    >> website.

    >
    > <snip>
    >
    > How about .htaccess? It's server-side and so more secure than client-side -
    > and it's dead easy.
    >
    > http://www.javascriptkit.com/howto/htaccess3.shtml
    >
    >
    > --
    > PeterMcC
    > If you feel that any of the above is incorrect,
    > inappropriate or offensive in any way,
    > please ignore it and accept my apologies.
    >
     
    Narlen, Nov 1, 2005
    #4
  5. Narlen

    Jemdam.com Guest

    Jemdam.com, Nov 1, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Narlen
    Replies:
    9
    Views:
    459
    brucie
    Nov 4, 2005
  2. ©®
    Replies:
    8
    Views:
    432
    kchayka
    Feb 3, 2006
  3. AAaron123
    Replies:
    2
    Views:
    2,363
    AAaron123
    Jan 16, 2009
  4. AAaron123
    Replies:
    1
    Views:
    1,418
    Oriane
    Jan 16, 2009
  5. Narlen

    How can I password protect a page?

    Narlen, Nov 5, 2005, in forum: Javascript
    Replies:
    3
    Views:
    113
Loading...

Share This Page