Page 1 of 4 123 ... LastLast
Results 1 to 10 of 35

Thread: Log in to a website page with a password

  1. #1
    Join Date
    Sep 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Log in to a website page with a password

    Hi, I am a small amateur and I make a website for my club but we would like that the members can view some webpage’s only via a login with password, lets say I have a report that only the members can read, so to read this report a login and password would be filled in by the member, the password would be supplied by me.
    Can someone please provide me with the data to use, I still have a lot to learn, thanks that this site provide me the support
    Thanks in advance for your great support

    Al
    Last edited by ostcalling; 09-04-2004 at 10:20 AM.

  2. #2
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Password protection

    Here's a script which prompts the user, and gives them 3 chances to get it right.


    Code:
    <!-- THREE STEPS TO INSTALL THREE TRIES:
    
       1.  Put the first code into the HEAD of your HTML document
       2.  Change protectedpage.html to your protected page
       3.  Add the final code to the BODY of your HTML document  -->
    
    <!-- STEP ONE: Copy this code into the BODY of your HTML document  -->
    
    <HEAD>
    
    <SCRIPT LANGUAGE="JavaScript">
    
    <!-- Begin
    function password() {
    var testV = 1;
    var pass1 = prompt('Please Enter Your Password','');
    while (testV < 3) {
    if (!pass1) 
    history.go(-1);
    if (pass1 == "password") {
    alert('You Got it Right!');
    
    <!-- STEP TWO: Change protectedpage.html to your protected page  -->
    
    //  Change the following URL to your protected filename
    
    window.open('protectedpage.html');
    break;
    } 
    testV+=1;
    var pass1 = 
    prompt('Access Denied - Password Incorrect, Please Try Again.','Password');
    }
    if (pass1!="password" & testV ==3)               
    history.go(-1);
    return " ";
    }
    // End -->
    </SCRIPT>
    </head>
    
    <!-- STEP THREE: Copy the last code into the BODY of your HTML document  -->
       
    <BODY>
    
    <CENTER>
    <FORM>
    <input type="button" value="Enter Password Protected Area" onClick="password()">
    </FORM>
    </CENTER>
    Copyright javascript.internet.com
    Last edited by cr3ative; 09-03-2004 at 04:04 PM.
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  3. #3
    Join Date
    Sep 2004
    Location
    Tacoma, WA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Slight problem, anybody could look at the source code and easilly figure out the password. They got an encrypted one here though. Either way, I find it easier just to look at destination of the login and bypass it altogether, not that I'd do that kind of thing.
    Last edited by Chronos; 09-03-2004 at 02:55 AM.

  4. #4
    Join Date
    Sep 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks for quick reply, it will help I am shure of that, but watt I want is that all the differend menbers have there one password, so the members have to log-in with there one password, name ans password to see the other webpages
    Anyway Thanks again for your great support
    p.s I will buy you a beer

  5. #5
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Do you just want all the members logins to point to the same page, or do you want to point to different pages when different logins are entered? I could probably create or find a script to suit either need.

    p.s I already have beer.
    Last edited by cr3ative; 09-03-2004 at 04:09 PM.
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  6. #6
    Join Date
    Sep 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I just want that the members use there naam and a password ho is selected by me to go to one webpage, all the members go to the same page, once this page is left thy have to log in again, i want to put information on this page ho is only for the members.
    Because you give me a good idee, it would great that you can acces three pages with three different passwords
    again thanks ad by the way thats three beers ....sheers

    Al
    Last edited by ostcalling; 09-03-2004 at 04:22 PM.

  7. #7
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Here's a script found at javascript.internet.com which should suit your needs.

    Code:
    <!-- TWO STEPS TO INSTALL MULTIPLE USERS PROMPT:
    
       1.  Add the first code into the HEAD of your HTML document
       2.  Copy the last coding into the BODY of your HTML document  -->
    
    <!-- STEP ONE: Add code to HEAD of login HTML document  -->
    
    <HEAD>
    
    <SCRIPT LANGUAGE="JavaScript">
    
    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->
    
    <!-- Begin
    function LogIn(){
    loggedin=false;
    username="";
    password="";
    username=prompt("Username:","");
    username=username.toLowerCase();
    password=prompt("Password:","");
    password=password.toLowerCase();
    if (username=="guest" && password=="login") { 
    loggedin=true;
    window.location="home-page.html";
    }
    if (username=="guest2" && password=="login2") {
    loggedin=true;
    window.location="home-page2.html";
    }
    if (loggedin==false) {
    alert("Invalid login!");
    }
    }
    // End -->
    </SCRIPT> 
    
    <!-- STEP TWO: Put this code in BODY of your HTML document  -->
    
    <BODY>
    
    <center>
    <form><input type=button value="Login!" onClick="LogIn()"></form>
    </center>
    
    <p><center>
    <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
    by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
    </center><p>
    
    <!-- Script Size:  1.29 KB  -->
    If you need me to explain anything in the code, just shout

    Hope this helps
    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  8. #8
    Join Date
    Sep 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks this will help a lot,
    So if I have 100 members I have to put 100 pasw in the HEAD section.
    is there no way to use a database ??? sorry to ask, you help is very greatfull for me
    wat woould be nice is that like on some website like this one dynamicdrive.com you also have to log in the same system and shape would be fantastic
    anyway thaks 100x

    Al

  9. #9
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes, you would have to put that many passwords in the header, unless you put the script in an external file (may be more secure as well).

    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  10. #10
    Join Date
    Sep 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    and how do I do that ??
    can you help me with that ??

    thats four beers now ...nearly a 6-pack
    Thanks again
    al

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •