Ver Mensaje Individual
  #11 (permalink)  
Antiguo 10/03/2016, 11:09
Avatar de petit89
petit89
 
Fecha de Ingreso: marzo-2011
Mensajes: 1.135
Antigüedad: 13 años, 1 mes
Puntos: 170
Respuesta: Como hacer dos menús diferentes dependiendo del logeo

eso se arregla agregando un if de redireccionamiento:

Código PHP:
<?php   

session_start
();
 
if (isset(
$_POST['Enviar'])) {
require
'Conection.php';

$usuario $_POST["username"]; 
$clave $_POST["userpwd"]; 

if(
$usuario!= "" && $clave!= ""){ 
$sql 'SELECT Usuario,Contraseña,Tipo FROM users WHERE Usuario = "'.$usuario.'"'
$query=mysqli_query($conexion,$sql);
if(
$umysqli_fetch_array($query)){ 
if(
$u["Contraseña"] == $clave){ 
$_SESSION["Usuario"] = $u['Usuario']; //asi lo seleccionas en SQL y no username, revisa
$_SESSION['Tipo'] = $u['Tipo']; // esto deberia devolver 1 ó 0

///AHORA A REDIRECCIONAR
if($u['Tipo'] == 1){
header("location:../index1.php");
exit();
}else{
header("location:../indexX.php");
exit();
}
}     
}else{ 
echo 
'Clave incorrecta. Volve a loguearte'

}else{ 
echo 
'Usuario inexistente'
}
}
 
?>
__________________
█ WebHosting / Reseller a bajo costo | Uptime Garantizado | Soporte en Español e Ingles
¿Te sirvió la respuesta? Deja un +1 (Triangulo negro al lado derecho)