Jump to content


Photo

Problem with PASSWORD() encoding


  • Please log in to reply
1 reply to this topic

#1 Taipan

Taipan
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 12 March 2006 - 03:53 AM

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:-
$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() )";
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:-
$query = "SELECT customer_id, first_name FROM customers WHERE email = '$e' AND password = PASSWORD('$p')";

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

#2 Taipan

Taipan
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 12 March 2006 - 05:37 AM

I figured it, the database field only had 16 characters allocated for it, it needed around 40. Now it works. :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users