...

View Full Version : Password Verification ?



fireblade
06-01-2007, 06:59 AM
I am creating a user login page using PHP/MySQL. I want to verify the password in the database and which user enters during the login information page.

I have encrypted the Password in database using
Password('$password')
Do I need to decrypt the password in database to verify it with the login entry password?

Or what are there any other ways? can any one give me a way :confused:

matak
06-01-2007, 09:58 AM
why don't you just try it?

tram
06-01-2007, 01:33 PM
hello, i used md5 for the encryption. to verify log in, i used the following codes:

$uname = $_GET['username'];
$pwd = md5($_GET['password']);

$qry_result = mysql_query("SELECT * FROM USERS WHERE USERNAME='$uname' and PASSWORD='$pwd'");

if((mysql_num_rows($qry_result) == 0)) {
//INVALID LOG IN
}
else{
//VALID. do your stuffs here
}

jream
06-01-2007, 07:04 PM
I've used MD5 in the past and I would go that route. Good Hashbrowns :)

fireblade
06-02-2007, 06:00 AM
what about the way I have used here beLow??


function is_password_match($username, $userpass) {

$SQL=SELECT userID FROM user WHERE userID='$username' AND password=Password('$userpass');

$id=db_connect();
if ($id) {
$rs=mysql_query($SQL, $id);
$num_rows=mysql_num_rows($rs);

if ($num_rows<1) {
db_close($id);
return false;
exit();
}
else if ($num_rows=1) {
db_close($id);
return true;
exit();
}
else {
db_close($id);
return false;
exit();
}
}
return false;
}


any suggestion?
Thanks everybOdy!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum