Advertisement
Guest User

Untitled

a guest
Mar 29th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <?php
  2.  
  3. function registerusers(){
  4. $username =$_POST['username'];
  5. $password =$_POST['password'];
  6. $error = "Your Login Name or Password is invalid";
  7. echo "$username";
  8. $sql = "SELECT id FROM users WHERE username = '$username' and password = '$password'";
  9. $result = mysqli_query($conn,$sql);
  10. $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
  11. $count = mysqli_num_rows($result);
  12. if($count == 1) {
  13. ?>
  14. <script type="text/javascript">
  15. $("div#ack").html("Successfully");
  16. </script>
  17. <?php
  18. }else {
  19. ?>
  20. <script type="text/javascript">
  21. $("div#ack").html("Invalid user and password");
  22. </script>
  23. <?php
  24. }
  25. }
  26. registerusers()
  27.  
  28. $("button#submit").click( function() {
  29. if( $("#username").val() == "" || $("#password").val() == "" ){
  30. $("div#ack").html("Please enter both username and password");
  31. }else{
  32. $.post( $("#myForm").attr("action"),
  33. $("#myForm :input").serializeArray(),
  34. function(data) {
  35. $("div#ack").html(data);
  36. });
  37. $("#myForm").submit( function() {
  38. return false;
  39. });
  40. }
  41. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement