Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/05/2011, 06:48
Avatar de apolazo
apolazo
 
Fecha de Ingreso: mayo-2011
Ubicación: Cabrero
Mensajes: 118
Antigüedad: 13 años
Puntos: 2
Respuesta: Validar Admin o Profesor

Me va quedando mas menos asi

Código PHP:
<?php 
include("funciones.php"); 
$conexion=coneccion();

if ( 
$_POST["run"] && $_POST["contrasena"] )
    {
    
$sql="SELECT * FROM profesor WHERE RUN='".$_POST["run"]."'";

    
$resultado=mysql_query($sql,$conexion);
    
$datos=mysql_fetch_array($resultado);

    if (
$datos["CONTRASENA"]==$_POST["contrasena"] && $datos["CONTRASENA"]==$_POST["contrasena"])
        {
        
session_destroy();
        
session_start();
        
        
$_SESSION["RUN"]=$datos["RUN"];
         
$_SESSION["CONTRASENA"]=$datos["CONTRASENA"];
        
      if (
$datos["tipo_profesor"]=='admin')
        {
            
header("Location:inicio_administrador.php");
        }
        else
                {
            
header("Location: inicio_profesores.php");
        }
echo 
$sql."  ".mysql_error();
        
header ("Location: index.php");
        }
    else
    {
        
$n1="Error RUN y/o Contrasena son incorrectos";
        
header("Location: index.php?n1=$n1");
        }
    }
    
?>
Pero me dice k el usuario y contraseña son incorrectos, aun que los ponga bien...
Ayuda plz, gracias