Help PHP Login
#1

Hi, i want to do a PHP Login for my PCU, but i have a problem; "i dont know how to do that because i have encrypted passwords with Whirlpool." if you know how to do that, please send me a message! i need that!.
Have a good day!
Reply
#2

SA-MP Scripting =\= PHP
Reply
#3

PHP has a function for hashing strings with Whirlpool aswell.
Reply
#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
#5

* I know its not your answer but use $_GET['username'] not $_POST['username'], anyone can harsh it if your script is not pro.
* Don't use mysql, use mysqli instead, others can use sql injection on mysql
* Don't post peoples IP please, you could remove it with paint or something
Reply
#6

I don't recommend writing your own panel if you have no experience.
  • $_POST['username'] is not a safe string. Don't use it directly in a query. A user could basically supply anything here, possibly corrupting the query.
  • Don't use the 'mysql' module; it's deprecated. Use mysqli or PDO instead.
  • The <center> tag is deprecated, as is the <font> tag (since 1999, no less). Use CSS for styling.
Reply
#7

somebody can help me fixing that?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)