Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/07/2005, 09:01
escolta1
 
Fecha de Ingreso: julio-2005
Mensajes: 5
Antigüedad: 18 años, 9 meses
Puntos: 0
error en forma simple para login

Tengo el siguiente codigo php, es una forma para solicitar password y username, pero no esta funcionando, asi que agregue un echo para ver que esta sucediendo....entonces entro a la pagina, pongo user: rene y password: 1111 y presiono aceptar...

segun yo
Código PHP:
echo $strSQL
debería arrojar:

SELECT user, ID from soluciones where user = 'rene' and ID = '1111'

pero en vez de eso arroja

SELECT user, ID from soluciones where user = '' and ID = '0'

entonces, segun el siguiente codigo ¿debo de recibir esta ultima linea o la primera? y tambien ¿como afecta que comienze con
Código PHP:
]<?php session_start(); ?>
?


Código PHP:
<?php session_start(); ?>
<html>
<head>

</head>

<body>

<form action="login.php" name="login" method="post">
User <input type="text" size="20" name="user">
Password <input type="password" size="20" name="pass">
<input type="submit" name="submit" value="Aceptar">
</form>

<?php
 
if ($submit)
 {    

    
$dbcnx mysql_connect("localhost""selex""seguridad911");
    
mysql_select_db("selex"$dbcnx);

    
    
$strSQL "SELECT user, ID from soluciones where user = '$user' and ID = '$pass' ";
    
$res mysql_query($strSQL);
    echo 
$strSQL;
     
$x = @mysql_num_rows($res);
    
 if (
$rs= @mysql_fetch_array($res))
 {
$_SESSION['user'] = $rs['user'];
$_SESSION['pass'] = $rs['ID'];


 
 } 
//end if session y redireccion para desplegar informacion en la otra pagina con bandera para identificar si se llego a esa pagina por medio de esta

elseif ($x=='0')
{
    
$error "Verifica tu Username y Password";
    echo 
$error;
}
//end if error login
 



 
}//end submit
?>





</body>
</html>