Inserting and retrieving a password
Posted: Mon Nov 29, 2004 10:54 am
Hi All,
I have a password field to allow a user to log into an admin panel, but I'm having trouble with encryption.
Currently I am adding in the users manually through phpMyAdmin with the following SQL
This obvioulsy adds a hashed value into the table. However, when I try and retrieve it for authentication purposes it won't return any rows. What am I doing wrong
Is there a better way of doing this?
I have a password field to allow a user to log into an admin panel, but I'm having trouble with encryption.
Currently I am adding in the users manually through phpMyAdmin with the following SQL
Code: Select all
insert into table (username, password)
values ('adminuser', md5('adminuserpwd'));Code: Select all
$passCheck = mysql_query("select password from form_admin where password = md5('".$_POST['password']."')");
if(mysql_num_rows($passCheck) == 0)
{
$error_msg .= "Your password is invalid";
}