Jump to content

md4


mbvo

Recommended Posts

I don't get this, I downloaded phpass-0.0 and extracted to my htdocs, and ever time i refresh test.php it gives me something differant.  are these the password hashes that would be saved to the database? and if so why do they keep changing and how do i compare 2 hashes that rn't identical?
Link to comment
https://forums.phpfreaks.com/topic/19704-md4/#findComment-85991
Share on other sites

Personally I would use MD5 -- its the most secure that ive found.. 

So when they register you run this..

$pw = md5($_POST['password']);

then when they log in you do this...
[code]
<?php
$pw = md5($_POST['password']);
$un = $_POST['username'];
$query = mysql_query("SELECT * FROM users WHERE username LIKE BINARY '$un' AND password = '$pw'");
$query = mysql_fetch_assoc($query);
if (sizeof($query) == "" || sizeof($query) == "0") {
// invalid user
} else {
// valid user
}
?>
[/code]

Thats a quick type job and might contain some errors though for the most part should work.. 

note: using LIKE BINARY in your query will make it so the username is case sensitive..  its the same I way I do mine.
Link to comment
https://forums.phpfreaks.com/topic/19704-md4/#findComment-85997
Share on other sites

Both will work...  now if you did it like this..

'SELECT * FROM users WHERE username LIKE BINARY '$un' AND password = $pw'

it would not...  if you are going to submit strings in your query you have to use " at the beginning and end and escape the string by using ' around it...  Thats the way I've always done it though sometimes I'll do it like the way you've shown -- well almost..
Link to comment
https://forums.phpfreaks.com/topic/19704-md4/#findComment-86003
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.