Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. function login()
  2.  
  3. {
  4.  
  5. var loginusr = document.getElementById('loginusername').value;
  6.  
  7. var loginpass = document.getElementById('loginpassword').value;
  8.  
  9. var test = 1;
  10.  
  11. var srvresp;
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19. var xmlhttp;
  20.  
  21. if (window.XMLHttpRequest)
  22.  
  23. {// code for IE7+, Firefox, Chrome, Opera, Safari
  24.  
  25. xmlhttp=new XMLHttpRequest();
  26.  
  27. }
  28.  
  29. else
  30.  
  31. {// code for IE6, IE5
  32.  
  33. xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  34.  
  35. }
  36.  
  37. xmlhttp.open("GET",'login.php?loginusername=' + loginusr + '&loginpassword=' + loginpass, true);
  38.  
  39. xmlhttp.send();
  40.  
  41. xmlhttp.onreadystatechange=function()
  42.  
  43. {
  44.  
  45. if (xmlhttp.readyState==4 && xmlhttp.status==200)
  46.  
  47. {
  48.  
  49. srvresp = xmlhttp.responseText;
  50.  
  51. if(srvresp == 0)
  52.  
  53. {
  54.  
  55. document.write(" not authenticated");
  56.  
  57. }
  58.  
  59. else
  60.  
  61. {
  62.  
  63. document.write("authenticated");
  64.  
  65. }
  66.  
  67.  
  68.  
  69.  
  70.  
  71. }
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement