Jump to content

Archived

This topic is now archived and is closed to further replies.

Taipan

Problem with PASSWORD() encoding

Recommended Posts

Hi,

I moved my website to a new server and now the password encoding doesn't work anymore. I am not sure if the new server has a different version of php. Can't think why this would not work anymore.

This is the code that enters the info into the database when someone registers:-[code]$query = "INSERT INTO customers ( first_name, last_name, email, street_name, city_name, state_name, post_code, country_name, phone_number, password, registration_date) VALUES ( '$fn', '$ln', '$e', '$sn', '$cn', '$st', '$pc', '$c', '$ph', PASSWORD('$p'), NOW() )";
[/code]
and when you try to log in this code is checking the email address and password, if there is a match it logs them in:-
[code]$query = "SELECT customer_id, first_name FROM customers WHERE email = '$e' AND password = PASSWORD('$p')";
[/code]

If I take out the PASSWORD() part and just enter in the password as '$p' then it works fine. If anyone has any ideas why this no longer works, I'd really appreciate the help.

Chris

Share this post


Link to post
Share on other sites
I figured it, the database field only had 16 characters allocated for it, it needed around 40. Now it works. :D

Share this post


Link to post
Share on other sites

×

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.