Advertisement
Guest User

Untitled

a guest
Mar 19th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link href="test.css" type = "text/CSS" rel = "stylesheet" >
  5. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
  6. <script type="text/javascript" src="scrpt.js"></script>
  7. </head>
  8. <body>
  9. <form>
  10. <label> First Name: </label>
  11. <br>
  12. <input class = "inp" type = "text" name = "fname" id = "fname"> </input>
  13. <br>
  14. <label> Last Name: </label>
  15. <br>
  16. <input class = "inp" type = "text" name = "lname" id = "lname"> </input>
  17. <br>
  18. <label> Email: </label>
  19. <br>
  20. <input class = "inp" type = "text" name = "email" id = "email"> </input>
  21. <br>
  22. <label> Username: </label>
  23. <br>
  24. <input class = "inp" type = "text" name = "usrname" id = "usr"> </input>
  25. <br>
  26. <label> Password: </label>
  27. <br>
  28. <input class = "inp" type = "password" name = "psw" id = "psw"> </input>
  29. <br>
  30. <input type = "submit" id = "submit" > </input>
  31. <br>
  32. <label> Login: </label>
  33. <br>
  34. <input class = "inp" type = "text" name = "login" id = "log"> </input>
  35. <br>
  36. <label> Password: </label>
  37. <br>
  38. <input class = "inp" type = "password" name = "logPsw" id = "logPsw"> </input>
  39. <br>
  40. <input type = "submit" id = "logSub" > </input>
  41. </form>
  42.  
  43. </body>
  44. </html>
  45.  
  46. $(document).ready(function(){
  47. $("#submit").click(function(){
  48. var fn = $("#fname").val();
  49. var ln = $("#lname").val();
  50. var email = $("#email").val();
  51. var usr = $("#usr").val();
  52. var psw = $("#psw").val();
  53. $.ajax(
  54. {
  55. type: "POST",
  56. url: "register.php",
  57. data: {
  58. fname: fn,
  59. lname: ln,
  60. email: email,
  61. usr: usr,
  62. psw: psw
  63. },
  64. success: function(result){
  65.  
  66. }
  67. }
  68. );
  69. });
  70.  
  71. $('#logSub').click(function(){
  72. var login = $("#log").val();
  73. var psw = $("#logPsw").val();
  74. $.ajax(
  75. {
  76. type: "POST",
  77. url: "login.php",
  78. data: {
  79. login: login,
  80. password: psw
  81. },
  82. success: function(result){
  83. alert(""+result);
  84. }
  85.  
  86. }
  87. );
  88. });
  89. });
  90.  
  91. <?php
  92.  
  93. $servername = "localhost";
  94. $username = "root";
  95. $password = "";
  96. $dbname = "admin_db";
  97.  
  98. $conn = new mysqli($servername, $username, $password, $dbname);
  99. if ($conn->connect_error) {
  100. die("Connection failed: " . $conn->connect_error);
  101. }
  102.  
  103.  
  104.  
  105. $login = $_POST['login'];
  106. $psw = $_POST['password'];
  107.  
  108.  
  109. $sql = "select * from user where userName = "$login" and password = "$psw"";
  110.  
  111. $result = $conn->query($sql);
  112.  
  113. if ($result->num_rows > 0) {
  114. echo "Yes";
  115. }
  116. else{
  117. echo "No Such Account";
  118. }
  119. $conn->close();
  120.  
  121. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement