![Distraido](http://static.forosdelweb.com/fdwtheme/images/smilies/rolleyes.png)
ESTE ES EL FRONTAL DESDE EL CUAL INTENTO ENVIAR LOS DATOS PARA Q AUTENTIFIQUE EL PHP, ENVIA PERO NO HABRE LA SIGUIENTE PAGINA SE QUEDA EN BLANCO NO SE SI SE ENVIAN LOS DATOS O QUE SUCEDE POR FAVOR AYUDA SOY NUEVO EN ESTE TEMA
Código HTML:
<?php session_start();?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="estilo.css" rel="stylesheet" type="text/css" /> <title>Registrarse</title> <style type="text/css"> <!-- .Estilo1 {color: #FF0000} .style1 {color: #FFFFFF} --> </style> <script language="javascript1.2"> function verificar(nombre, op) { if(op==1) { var m; for(m=0;m<nombre.length;m++) { if(nombre.elements[m].name=="txt_login" & nombre.elements[m].value=="") { alert("Usted no a ingresado ningun usuario para autentificarse") nombre.elements[m].focus() return false } if(nombre.elements[m].name=="txt_pass" & nombre.elements[m].value=="") { alert("Usted no a ingresado ninguna clave para autentificarse") nombre.elements[m].focus() return false } } } else {return true} } </script> </head> <body> <form id="form1" name="form1" method="post" action="comprobarlogin.php" > <table width="100%" height="150px" border="0" cellspacing="0" cellpadding="0" > <tr> <th scope="col" align="center"><table width="30%" height="600px" border="0"> <tr> <th scope="col"> <table width="100%" border="1" cellpadding="0" cellspacing="0" > <tr bordercolor="#000000" bgcolor="#FFFFFF" border="1"> <td nowrap="nowrap" scope="row" ><div align="center"><img src="imagenes/logo_pc.jpg" width="364" height="274" class="style1" /></div></td> </tr> <tr bgcolor="#000033" class="tabla"> <th class="tablaTitulo style1" scope="col" bgcolor="#000000">AUTENTIFICACION</th> </tr> <tr bgcolor="#E6EDF5" class="tabla1" scope="row"> <th scope="row"><table width="100%" border="0" class="tabla1"> <tr class="tablaCeldasGris"> <th width="41%" scope="col"><div align="right">login:</div></th> <th width="59%" scope="col"> <label> </label> <div align="left"> <input name="txt_login" type="text" id="txt_login" size="20" maxlength="20" /> <span class="Estilo1">*</span></div></th> </tr> <tr class="tablaCeldasGris"> <th scope="row"><div align="right">password:</div></th> <td><div align="left"> <input name="txt_pass" type="password" id="txt_pass" size="20" maxlength="20" /> <span class="Estilo1">*</span></div></td> </tr> <tr class="tablaCeldasGris"> <th scope="row"><div align="right">Tipo de usuario:</div></th> <td><div align="left"> <select name="cbo_tipousuario" id="cbo_tipousuario"> <option value="1" selected="selected">Administrador</option> <option value="2">Ventas</option> <option value="3">Gerencia</option> </select> <span class="Estilo1">*</span> </div></td> </tr> <tr class="tablaCeldasGris"> <th colspan="2" scope="row"><label> <input name="btnOk" type="submit" class="boton" value="aceptar" id="btnOk" /> <input name="btnOk" type="submit" class="boton" value="cancelar" id="btnOk" /> </label></th> </tr> </table></th> </tr> <tr bgcolor="#E6EDF5" class="tabla1" scope="row"> <th scope="row"> <?php echo($_SESSION['msnLogin']);?> </th> </tr> </table></th> </tr> </table></th> </tr> </table> </form> </body> </html>
Código PHP:
<?php
include("Connections/conexion.php");
switch($_GET["btnOk"])
{
case 'cancelar':
header("Location: index.php");
break;
case 'aceptar':
$login = $_GET["txt_login"];
$pass= $_GET["txt_pass"];
$tipo=$_GET["cbo_tipousuario"];
$conexion = conectarBDD();
if (!$conexion) {
echo "No pudo conectarse a la BD: " . mysql_error();
exit;
}
if (!seleccionarBDD()) {
echo "No ha sido posible seleccionar la BD: " . mysql_error();
exit;
}
$sql="select * from t_usuario where login='$login' and password='$pass' and cod_rol='$tipo'";
$resultado=mysql_query($sql,$conexion);
if(numeroFilas($resultado)==0){
session_start();
$_SESSION['msnLogin']='EL USUARIO NO EXISTE O NO PERTENECE AL ROL ASIGNADO';
header("Location: login.php");
}
else
{
session_start();
unset($_SESSION['msnLogin']);
$_SESSION['tipoRol']=$tipo;
header("Location: sistema.php");
}
break;
}
?>