Ver Mensaje Individual
  #4 (permalink)  
Antiguo 24/03/2015, 02:24
Balita
 
Fecha de Ingreso: febrero-2008
Mensajes: 49
Antigüedad: 17 años, 1 mes
Puntos: 0
Respuesta: Usar el contenido de una session en un if php

es lo mismo que en este tema que tambien hablaste tu
http://www.forosdelweb.com/f18/ayuda-urgente-notice-undefined-variable-_session-738602/

este es el fallo: Notice: Undefined variable: SESSION in C:\xampp\htdocs\ULE\dbyir\menu.php on line 19

Notice: Undefined variable: SESSION in C:\xampp\htdocs\ULE\dbyir\menu.php on line 43

Notice: Undefined variable: SESSION in C:\xampp\htdocs\ULE\dbyir\menu.php on line 68
no tienes rol

y este es el codigo entero
Código PHP:
<!doctype html>
<html lang="es">
    <head>        
        <meta charset="utf-8"/>
        <title> Titulo </title>        
    </head>
    <body bgcolor="lightgrey">

        <?php
            session_start
();
            
            
// Controlo si el usuario está logueado
            
if (!isset($_SESSION['nombre']))
            {
                
header('Location: index.html');
            }
            else
            {
                if(
$SESSION['rol'] == "administrador"){
        
?>
            
                <table width="100%">
                    <tr bgcolor="#0B2161">
                        <td width="50%">
                            <font color="white" face="arial">Bienvenido <?=$_SESSION['nombre']?> </font><br/>
                            <center><font color="white" size="6" face="arial">DBYIR</font></center>
                        </td width="20%">
                        <td>
                            
                            <p align="right"><a href='salir.php'><font color="white" face="arial">Salir</font></a></p>;
                        </td>
                    </tr>
                    <tr>
                        <td width="50%" bgcolor="lightyellow">
                            administrador
                            
                        </td>
                    </tr>
                    
                </table>
            
        <?php    
                
}elseif($SESSION['rol'] == "gestor"){

        
?>
        
            <table width="100%">
                    <tr bgcolor="#0B2161">
                        <td width="50%">
                            <font color="white" face="arial">Bienvenido <?=$_SESSION['nombre']?> </font><br/>
                            <center><font color="white" size="6" face="arial">DBYIR</font></center>
                        </td width="20%">
                        <td>
                            
                            <p align="right"><a href='salir.php'><font color="white" face="arial">Salir</font></a></p>;
                        </td>
                    </tr>
                    <tr>
                        <td width="50%" bgcolor="lightyellow">
                            gestor
                            
                        </td>
                    </tr>
                    
            </table>
        
        <?php    
                
}elseif($SESSION['rol'] == "usuario"){

        
?>
        
            <table width="100%">
                    <tr bgcolor="#0B2161">
                        <td width="50%">
                            <font color="white" face="arial">Bienvenido <?=$_SESSION['nombre']?> </font><br/>
                            <center><font color="white" size="6" face="arial">DBYIR</font></center>
                        </td width="20%">
                        <td>
                            
                            <p align="right"><a href='salir.php'><font color="white" face="arial">Salir</font></a></p>;
                        </td>
                    </tr>
                    <tr>
                        <td width="50%" bgcolor="lightyellow">
                            usuario
                        </td>
                    </tr>
                    
            </table>
        <?php    
                
}else{
                    echo 
"no tienes rol";
                }
            }

        
?>
    </body>
</html>