SA-MP Forums Archive
Help PHP Login - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help PHP Login (/showthread.php?tid=538617)



Help PHP Login - CoR3 - 22.09.2014

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!



Re: Help PHP Login - Stinged - 22.09.2014

SA-MP Scripting =\= PHP


Re: Help PHP Login - dusk - 22.09.2014

PHP has a function for hashing strings with Whirlpool aswell.


Re: Help PHP Login - CoR3 - 22.09.2014

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]


Re: Help PHP Login - pEmanZ - 22.09.2014

* 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


Re: Help PHP Login - Vince - 22.09.2014

I don't recommend writing your own panel if you have no experience.


Re: Help PHP Login - CoR3 - 22.09.2014

somebody can help me fixing that?