Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Login script with IE referrer solution

    Contents:
    Javascript basic login script with username and password (in black).
    Simple document.referrer on destination page to prevent direct URL entry and bookmarking.
    <body onload="if (document.referrer == '') self.location='my_alternate_page.html';">

    Problem:
    This works fine in Firefox, however in Internet Explorer - the login returns an empty http referrer, thus being bounced by the document.referrer.
    Solution:
    The update script (in green) solves the above problem.

    The only thing I am struggling with is connecting the update <a href> with the original script's location="".


    <script language="javascript">
    <!--//
    /*This Script allows people to enter by using a form that asks for a
    UserID and Password*/
    function pasuser(form) {
    if (form.id.value=="my_username") {
    if (form.pass.value=="my_password") {
    location="links to the update script in green"
    } else {
    alert("Invalid Password")
    }
    } else { alert("Invalid UserID")
    }
    }
    //-->
    </script>
    <a href="the_destination_page"
    onleftclick="window.open('','newwin','height=1000,width=1024','')"
    target="newwin"></a>

    <center>
    <table bgcolor="white" cellpadding="12" border="1">
    <tr><td colspan="2"><center><h1><i><b>Login
    Area</b></i></h1></center></td></tr>
    <tr><td><h1><i><b>UserID:</b></i></h1></td><td><form name="login"><input
    name="id" type="text"></td></tr>
    <tr><td><h1><i><b>Password:</b></i></h1></td><td><input name="pass"
    type="password"></td></tr>
    <tr><td><center><input type="button" value="Login"
    onClick="pasuser(this.form)"></center></td><td><center><br><input
    type="Reset"></form></td></tr></table></center>


    Any help "connecting the dots" would be appreciated.

  • #2
    New Coder
    Join Date
    Jun 2008
    Posts
    29
    Thanks
    0
    Thanked 2 Times in 2 Posts
    How about using cookies?

    Here's a better replacement for setCookie() and getCookie() - http://techpatterns.com/downloads/ja...pt_cookies.php

    Although I would really recommend using PHP as a login script instead -- javascript is iffy.


  •  

    Posting Permissions

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