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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.