Help PHP Login
#4

Humm, but... whats my error?

Quote:

<?php

include("includes/config.php");

if($_POST['login'])
{
$query = mysql_query("SELECT `ID`, `Password` FROM `users` WHERE `Username` = '" . $_POST['username'] . "'");

if(mysql_num_rows($query))
{
$row = mysql_fetch_assoc($query);
$password = $row['Contra'];
$hashedPassword = $_POST['password'];

if(!strcasecmp($hashedPassword, $password))
{
$_SESSION['Logueado'] = true;
$_SESSION['CuentaID'] = $row['ID'];
echo "<center><font class='outline' face='arial' color='#00FF00'><b>Usted, ha logueado correctamente.</b></font></center>";
redirect("index.php");
}
else echo "<center><font class='outline' face='arial' color='red'><b>Los datos ingresados son incorrectos.</b></font></center><br>";
}
else echo "<center><font class='outline' face='arial' color='red'><b>Los datos ingresados son incorrectos.</b></font></center><br>";
}

?>

<html>
<br>
<br>
<br>
<div id="ingreso">
<center>
<form action='ingreso.php' method='POST'>
Bienvenido, por favor ingrese su nombre y contraseсa.
<input type='text' name='Username' value='<?php echo $_POST['Username'] ?>' placeholder='Usuario' maxlength='24' size='30' /><br>
<input type='password' name='Password' placeholder='Contrase&ntilde;a' maxlength='50' size='30' /><br><br>
<input type='hidden' name='login' value='1' />
<input type='submit' value='' class='login' />
</form>
</center>
</div>
</html>

This is my DB

[IMG][/IMG]
Reply


Messages In This Thread
Help PHP Login - by CoR3 - 22.09.2014, 18:32
Re: Help PHP Login - by Stinged - 22.09.2014, 18:38
Re: Help PHP Login - by dusk - 22.09.2014, 18:50
Re: Help PHP Login - by CoR3 - 22.09.2014, 19:10
Re: Help PHP Login - by pEmanZ - 22.09.2014, 19:50
Re: Help PHP Login - by Vince - 22.09.2014, 20:04
Re: Help PHP Login - by CoR3 - 22.09.2014, 22:38

Forum Jump:


Users browsing this thread: 1 Guest(s)