Advertisement
Guest User

Untitled

a guest
Aug 10th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. $('#sublogin').click(function(){
  2. var user = $('#login').val();
  3. var pass = $('#password').val();
  4. //if($.trim(user).length > 0 && $.trim(pass).length > 0){
  5. $.ajax({
  6. url:"consulta.php",
  7. method:"POST",
  8. data:{user:user, pass:pass},
  9. cache:"false",
  10. beforeSend:function() {
  11. $('#sublogin').val("Conectando...");
  12. },
  13.  
  14. success:function(data) {
  15. $('#sublogin').val("Log in");
  16.  
  17. if (data=="1") {
  18.  
  19. //$(location).attr('href','index.php');
  20. header("location:index.php");
  21.  
  22. }
  23.  
  24. else{
  25. alert("Usuuario y contraseña incorrectos.");
  26.  
  27. }
  28. }
  29. });
  30. //}
  31. });
  32.  
  33. $numero_registro=$resultado->rowCount();
  34.  
  35.  
  36. if($numero_registro!=0){
  37.  
  38.  
  39. $_SESSION["user"]=$_POST["user"];
  40.  
  41.  
  42. echo "1";
  43. }
  44.  
  45. else{
  46. echo "error";
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement