Ver Mensaje Individual
  #5 (permalink)  
Antiguo 05/04/2016, 20:51
Avatar de luisgg
luisgg
 
Fecha de Ingreso: abril-2016
Mensajes: 7
Antigüedad: 8 años
Puntos: 0
Respuesta: problemas con el echo "<script type='text/javascript'>alert

Hola Crisalcivar
Intenta de esta manera depronto te funcione... Si no me cuentas que te aparece
Le agregue algo de mas en usuario y contrase;a para limpiarlos un poco, igual revisa que no puedan hacerte inyección sql u otros tipos de ataques
<?php
session_start();
?>
Código:
<!DOCTYPE php> 
<html> 
<head> 
<head> 
    <title>Validando...Por favor espere</title> 
    <meta charset="utf-8"> 
</head> 
</head> 
<body 
      <?php 
            include "conexioningreso.php"; 
            if(isset($_POST['login'])){ 
                $usuario = htmlentities($_POST['user']); 
                $pw = htmlentities($_POST['pw']); 
                $goto = "form1.php"; 
                $log = mysql_query("SELECT * FROM registroempresa WHERE user='$usuario' AND pw='$pw'"); 
                if(mysql_num_rows($log)>0){ 
                    $row = mysql_fetch_array($log); 
                    $_SESSION["user"] = $row['user']; 
                    $_SESSION["idEmpresa"] = $row['idEmpresa']; 
                    $_SESSION["nombreEmpresa"] = $row['nombreEmpresa']; 
                    echo '<script> window.location='.$goto.'; </script>';
                }else{
                    echo '<script type="text/javascript">alert("Usuario o contrasena incorrectos no existe");</script>'; 
                    echo '<script> window.location="index.php"; </script>'; 
                }  
            } 
        ?> 
</body> 
</html>