SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2003
    Location
    oklahoma
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry Password Script PROBLEM!

    I want to make one password form so that users can come onto the site, place their personal user name and password, and it will take them to their "update page" ( just a page that only they can get to with their password and with their own info). I got this js off the internet and with the description it said I could make several user account's and names, but I cant get it to work:

    <body>
    <form>
    <p>ENTER USER NAME :
    <input type="text" name="text1">
    </p>
    <p> ENTER PASSWORD :
    <input type="password" name="text2">
    <input type="button" value="Check In" name="Submit"
    onclick=javascript:validate(text3.value,"1",text4.value,"2",text5.value,"3",text6.value,"4") >
    </p>
    </form>


    <script language = "javascript">

    function validate(text1,text2,text3,text4,text5,text6)
    { if (text1==text3 && text2==text4)
    load('success.html');

    if (text1==text5 && text2==text6)
    load('success1.html');

    else

    { alert("Invalid UserID"); }}

    function load(url)
    { location.href=url; }
    </script>
    </body>


    PLEASE HELP THIS DESPERATE PERSON THAT DOSENT UNDERSTAND!

  2. #2
    SitePoint Zealot tss68nl's Avatar
    Join Date
    Nov 2002
    Location
    Netherlands
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First of all...username and password checking with javascript is bad, very bad. No matter how you create your script, people will *always* be able to read all usernames and passwords from the source of the page. Forget about encoding js files as well, as they are easily decoded again.

    Secondly, I dont know where you got the above script, but it hardly makes sense. The function you call takes 6 arguments, but it tries to call it with 8. Furthermore, only half the input variables exist since text3.value to text6.value dont exist.
    Also, on an onclick event, you do not have to specify the 'javascript:' identifier, but you *do* need to double quote the whole thing. You can single-quote the values you are trying to pass to your function.

  3. #3
    SitePoint Member
    Join Date
    Nov 2003
    Location
    oklahoma
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Need's Script

    Wel I don't mind the being able to veiw the source and finding passwords. Uuummmm.... If someone could do me a fav. and write a script like the one above or if you have one that you feel works better please post the script and instructions on how to add and modify accounts.


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
  •