Results 1 to 2 of 2

Thread: This script doesn't work, help

  1. #1
    Join Date
    Apr 2016
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default This script doesn't work, help

    So, im trying to create a simple generic login for a group to access a specific part of a website I have running through google sites. And i mashed two scripts i did as training, and some personal html know-how. to get this. but when i try to login it doesnt work. Please help!

    Code:
    <html>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function LogIn(){
    loggedin=false;
    username="";
    password="";
    username=username.toLowerCase();
    password=password.toLowerCase();
    if (username=="jeremy" && password=="js") { 
    loggedin=true;
    window.open("http://www.facebook.com");
    }
    if (username=="aracelie" && password=="am") {
    loggedin=true;
    window.open("http://www.facebook.com");
    }
    if (loggedin==false) {
    alert("Invalid login!");
    }
    }
    </SCRIPT> 
    <BODY>
    <form>
    <p>Username:</p>
    <input type="text" name="username">
    <p>Password:</p>
    <input type=password name="password"><br>
    <form><input type=button value="Login" onClick="LogIn()"></form>
    </form>
    </body>
    </html>
    Last edited by jscheuer1; 04-04-2016 at 12:43 AM. Reason: format code

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    First of all, you cannot do a secure login via (as appears to be being attempted here) javascript alone. That said, a sort of pseudo secure login via javascript could be done, easily hacked by anyone familiar with looking at source code and/or using the various "web tools" available in most modern browsers.

    It's also possible that the code you're presenting in your post is only enhanced by javascript, and that the real action is server side, as would be necessary for any truly secure login, but it's hard to be sure one way or the other. I'm thinking perhaps you copied what code you could see from a secure server side script, meaning - you missed most of it. And then, following from what you say, mashed that up best you could with some insecure, but perhaps serviceable javascript login code.

    Anyways, you say it doesn't work, and I'm not surprised.

    Before I or anyone goes further here, we should probably establish just what you're after. There could be other possibilities, but the main two seem to be:

    1) A secure login script that uses server side code perhaps enhanced via javascript.

    Or:

    2) Just some sort of javascript barrier that can by its very nature be easily circumvented, but that will keep out complete idiots, and those not too intense about getting in against your wishes.

    Which is it that you want? Something else?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Script doesn't work in IE8!! Help!!!
    By SamyCode in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 01-11-2011, 03:08 PM
  2. Iframe SSI script II doesn't work in FF
    By davkraid in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 06-26-2009, 08:29 AM
  3. Pop-it menu script doesn't work in IE
    By AppleAl in forum Dynamic Drive scripts help
    Replies: 7
    Last Post: 04-10-2008, 10:14 AM
  4. Iframe SSI script II doesn't work with PHP
    By natbur in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 08-02-2005, 04:39 AM
  5. Clock script doesn't work
    By Marra in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 06-11-2005, 06:19 PM

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
  •