Advanced Search

Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: Login and Password code

  1. #1
    Join Date
    Aug 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Login and Password code

    I have a question and i hope someone can help. I want to have a page on a freinds site be password protected. He is using front page 2000 and wants to have a page that has a log on box that will then re-direct you into the protected page or however that works. There will be multiple users with different passwords. I have searched a few codes on this site but we can't get any of them to work. HHEEEEELLLPPP

  2. #2
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    You may have heard this but there Javascript isn't a good way todo this. But if you can't do or don't know if you can do server scripts then i'll look... I think I might know one that was pretty good hold on while i get it

  3. #3
    Join Date
    Aug 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    OK thanks, I'm patiently awaiting the code.. Thanks

  4. #4
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    Ok, I got it... Here it is... this uses Javscript you SHOULDN'T use it for user data with private information like street addresses, credit card numbers, or anything else...

    HTML Code:
    <HEAD>
    
    <SCRIPT LANGUAGE="JavaScript">
    <!-- I highly suggest to add atleast some protection to make the script into an external js document... that way its just a tiny bit more secure... -->
    
    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!");
    }
    }
    </SCRIPT> 
    
    <BODY>
    
    <center>
    <form><input type=button value="Login!" onClick="LogIn()"></form>
    </center>
    If you don't know how to edit the code i'll show you what to do *in order to add more users, and remove...*

  5. #5
    Join Date
    Aug 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    when i copy and paste the code into the page and hit preview, it just shows the html code ??

  6. #6
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    Quote Originally Posted by Kevin1201 View Post
    when i copy and paste the code into the page and hit preview, it just shows the html code ??
    Uh, by that meaning ok, let me show you how to insert it


    HTML Code:
    <html>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    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!");
    }
    }
    </SCRIPT> 
    <BODY>
    <center>
    <form><input type=button value="Login!" onClick="LogIn()"></form>
    </center>
    </body>
    </html>
    If that doesn't work, then I don't know what will...

  7. #7
    Join Date
    Aug 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yea, I don't know either. I tried it but it won't work. It just keeps showing up on the page as html. ?

  8. #8
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    Oh i no why

    ok, change this
    where it says
    Code:
    <script type="javascript">
    Change it to
    Code:
    <script type="text/javascript">

  9. #9
    Join Date
    Aug 2007
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Wow, I got excited for a minute thinking that might work but nope. I'm thinking that front page doesnt like the code or something. I'm sooooooofrustrated. I have been fighting this all day almost. Thanks

  10. #10
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    Did you try in your web browswer or is it just not working, I'm sorry man I don't know what that is...

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
  •