Jump to content

Password function error in Mysql


natasha

Recommended Posts

hi all,

I am using PHP-MySql and use the following code for login authentication:

 

<?

$res=@mysql_query(\"select * from users where login=(\'$txtlogin\') and password=password(\'$txtpassword\')\");

?>

 

$txtlogin and $password are the text field names. The database has stored the password in the encrypted format. But still it i snot authenticating.

The connection to mysql etc is working. Without the encryption, the logn authentication works...what can be possibly wrong?

a very very perplexed

Natasha. :?:

Link to comment
Share on other sites

hi

Hmm.. this may sound silly to u..but I am pretty new to mysql. I hv just used the function password(string) to encrypt the password field in the database. and I just using \'password=password(\'$txtpassword\') as part of my query. It just refuses to authenticate..very maddening!

natasha

Link to comment
Share on other sites

Now when the passowrd is encrytpted

 

u have to do

 

select PASSWORD(\'$password_value\');

 

This will return a encrypted value and u have to compare this value.

 

I dont think u can decrypt the password vale that has been stored.

 

I hope this helps you.

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.