Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/09/2012, 18:24
luis123123
(Desactivado)
 
Fecha de Ingreso: septiembre-2012
Ubicación: Peru Villa Maria
Mensajes: 29
Antigüedad: 11 años, 7 meses
Puntos: 0
No me muestra mensaje JavaScript

Bueno el problema es que quiero que mi mensaje javascript se ejecute cuando el user o pass esta incorrecto.. este es mi codigo de mi archivo control.php

Código PHP:
<?php
session_start
();
include_once 
"conexion.php";
include_once 
"function_login.php";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Custom JavaScript Dialog Boxes</title>
<link rel="stylesheet" type="text/css" href="dialog_box.css" />
<script type="text/javascript" src="dialog_box.js"></script>
</head>
<body>

<?php
    $id 
$_POST['username'];
    
$n 1;
    
$user strtolower($id{$n 1});
switch (
$user)
    {    
        case  
"a":
        
$_POST['password'] = md5($_POST['password']);
            
        if(
verificar_login_a($_POST['username'],$_POST['password'],$result) == 1)
        {
            
$_SESSION['userid'] = $result->id_user;
            
header("location:admin/index.php");
        }
        else
        {
            
//header("location:index.php");
            
?>
            <script type="text/javascript">
                location.href="index.php";
            </script>
            <script type="text/javascript" src="dialog_box.js">
                javascript:showDialog('Error','User o clave incorrecto.','error',2)
                location.href="index.php";
            </script>
            <?php
        
}
        break;
        
        case 
"e":
        
$_POST['password'] = md5($_POST['password']);
            
        if(
verificar_login_e($_POST['username'],$_POST['password'],$result) == 1)
        {
            
$_SESSION['userid'] = $result->id_alumno;
            
header("location:alumno/index.php");
        }
        else
        {
            
header("location:index.php");
        }
        break;
        default:
            
header("location:index.php");
    }
?>
</body>
</html>
al probarlo, escribiendo un user q empieze con a y un pass falso me tiene que salir el mensaje pero se queda en la pagina en blanco control.php :S