Jump to content

md5() password


ballhogjoni

Recommended Posts

I am md5() my users passwords into my db. I have a login page and when the user puts his password in it doesn't match up. If I put the encode password in, it does match up. Can someone direct me to what I am doing worng?

 

code to encode password:

$_POST['passwd'] = md5($_POST['passwd']);

 

code to login:

$sql = mysql_query("SELECT password FROM users WHERE username = '$username'");
$fetch_em = mysql_fetch_array($sql);
$numrows = mysql_num_rows($sql);

if($numrows != 0 & $password == $fetch_em["password"]) {
$valid_user = 1;
} else {
$valid_user = 0;
}

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.