ausghostdog

mainpart

Nov 1st, 2011
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. //declare and set user information
  2. var users = new Array();
  3.  
  4. users["john smith"] =
  5. {
  6. "accountname" : "JSmith",
  7. "password" : "jsmi123",
  8. "accountbalance" : "$530.00",
  9. "accountnumber" : "997766",
  10. "customername" : "John smith"
  11. }
  12.  
  13.  
  14. //declare and set item details
  15.  
  16.  
  17.  
  18.  
  19. function validatelogin()
  20. {
  21. //assign user entered into to variables
  22.  
  23. var LoggedAccountNumber = document.getElementById('accountnumber').value;
  24. var LoggedAccountName = document.getElementById('accountname').value;
  25. var LoggedPassword = document.getElementById('password').value;
  26. // loop through the users array to find a match
  27.  
  28. for (i in users)
  29. {
  30. if (users[i]["accountnumber"] == LoggedAccountNumber && users[i]["accountname"] == LoggedAccountName && users[i]["password"] == LoggedPassword)
  31. {
  32. document.cookie = [i];
  33. flag = true;
  34. alert (document.cookie);
  35. }
  36. }
  37. if (flag == true)
  38. {
  39. window.open ("products.html");
  40. }
  41. else
  42. {
  43. alert ("incorrect details. please try again");
  44. }
  45.  
  46.  
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment