Welcome Guest, Not a member yet? Register   Sign In
Using the PASSWORD() function
#1

I am rebuilding an existing site in CodeIgniter which someone previously built in bespoke php which is largely full of depricated functionality hence the rebuild. This is my first CodeIgniter project but it seemed a good framework and fitted the requirement well.

My issue is, I don't have much flexibility on the existing database structure as it is full of 1000's of records of data. The issue I am facing is with the members section, the members have their credentials stored and the password is hashed using the mysql function PASSWORD(). I need to keep it that way other wise they'll have issues when logging in.

I tried to use the function in my data array for registering new accounts like so but it failed:

'lc_user' => PASSWORD($this->input->post('jbsEmail')),

I found a similar way to do it which was (not worried about sanitising the post data at this stage):

$hashedPassword = password_hash($this->input->post('jbsPassword'), PASSWORD_DEFAULT);
'lc_password' => $hashedPassword,

The trouble is here is php hashes the password so it will not be stored as the existing passwords, so when people go to log in I need to do something like:

WHERE password=PASSWORD($potsPassword), so based on that kind of scenario I think I need to be able to use PASSWORD() when running queries, I have not found a solution yet to be able to do this with CodeIgniter, can anyone suggest a solution?
Reply


Messages In This Thread
Using the PASSWORD() function - by barrypoore - 03-28-2018, 01:29 PM
RE: Using the PASSWORD() function - by jreklund - 03-28-2018, 02:24 PM
RE: Using the PASSWORD() function - by barrypoore - 03-28-2018, 02:49 PM
RE: Using the PASSWORD() function - by jreklund - 03-29-2018, 03:04 AM
RE: Using the PASSWORD() function - by barrypoore - 04-09-2018, 11:40 AM
RE: Using the PASSWORD() function - by jreklund - 04-09-2018, 12:50 PM
RE: Using the PASSWORD() function - by barrypoore - 04-09-2018, 01:44 PM
RE: Using the PASSWORD() function - by jreklund - 04-09-2018, 02:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB