Ver Mensaje Individual
  #4 (permalink)  
Antiguo 12/03/2020, 06:54
prueba230683
 
Fecha de Ingreso: abril-2011
Mensajes: 170
Antigüedad: 13 años
Puntos: 68
Respuesta: Direccionar segun el usuario

Prueba:

Código Javascript:
Ver original
  1. $.ajax({
  2.  
  3.             url:"logueame.php",
  4.             method:"POST",
  5.             data:{user_mail:user_mail, user_pass:user_pass},
  6.             cache:"false",
  7.             beforeSend:function(){
  8.                 $('#login').val("Conectando.....");
  9.  
  10.             },
  11.  
  12.               success:function(data){
  13.               $('#login').val("Login");
  14.               if (data == "1"){
  15.                 location.href = "/admin.php";
  16.               }else if(data == "2"){
  17.                 location.href = "/index.php";
  18.               }else{
  19.                  $("#result").html("<div class='alert alert-dismissible alert-danger'><button type='button' class='close' data-dismiss='alert'>&times;</button><strong>Errror</strong> las credenciales son incorrectas.</div>");
  20.               }
  21.              
  22.               }
  23.       });

Debes hacer el siguiente cambio en el PHP:

Código PHP:
Ver original
  1. if ($num_row=="1"){
  2.  
  3.     $data=mysqli_fetch_array($result);
  4.      $_SESSION["user_mail"]= $data["user_mail"];
  5.      $_SESSION["user_name"]= $data["user_name"];
  6.      $_SESSION["user_estado"]= $data["user_estado"];
  7.      
  8.  
  9.      echo $data["user_estado"];
  10.  
  11.      
  12. }else{
  13.    echo"error";
  14. }


Última edición por prueba230683; 12/03/2020 a las 07:01