Guest User

Untitled

a guest
Mar 12th, 2019
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script language="javascript">
  4. function postRequest(strURL){
  5. var xmlHttp;
  6. if(window.XMLHttpRequest){ // For Mozilla, Safari, ...
  7. var xmlHttp = new XMLHttpRequest();
  8. }
  9. else if(window.ActiveXObject){ // For Internet Explorer
  10. var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  11. }
  12. xmlHttp.open('POST', "login.php", true);
  13. xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  14. xmlHttp.onreadystatechange = function(){
  15. if (xmlHttp.readyState == 4){
  16. updatepage(xmlHttp.responseText);
  17. }
  18. }
  19. xmlHttp.send(strURL);
  20. }
  21.  
  22. function updatepage(str){
  23. if(str=="yes"){
  24. alert("Welcome User");
  25. }else{
  26. alert("Invalid Login! Please try again!");
  27. }
  28. }
  29.  
  30. function call_login(){
  31. var username = window.document.f1.username.value;
  32. var password = window.document.f1.password.value;
  33. var url = "username=" + username + "&password=" +password ;
  34. postRequest(url);
  35. }
  36. </script>
  37. </head>
  38.  
  39. <body>
  40. <Center>
  41.  
  42. <form name="f1" onsubmit="return call_login();">
  43. <table border="0" bgcolor="#CCCCFF" cellspacing="1" cellpadding="3" width="287">
  44. <tr>
  45. <td align="left" colspan="2" width="275"><b><font size="5" color="#000080">Login</font></b></td>
  46. </tr>
  47. <tr>
  48. <td align="right" width="81"><b><font color="#000080">User
  49. Name:</font></b></td>
  50. <td width="184"><input type="text" name="username" id="user" size="20" value="" /></td>
  51. </tr>
  52. <tr>
  53. <td align="right" width="81"><b><font color="#000080">Password:</font></b></td>
  54. <td width="184"><input type="password" name="password" size="20" value="" /></td>
  55. </tr>
  56. <tr>
  57. <td colspan="2" align="center" width="275"><input type="button" name="a1" value="Login" onclick="call_login()"></td>
  58. </tr>
  59. </table>
  60. </form>
  61.  
  62. </center>
  63. </body>
  64. </html>
Add Comment
Please, Sign In to add comment