Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Converting Password


sniperfox

Recommended Posts

Hello there!

 

I wanna convert my old customers table (from my old site) to the oscommerce customers table.

I tried it but I got a problem with passwords. My old table dont have encriptation. I write this script to encriptate the password in one record in the table:

 

$i=6; //record 6

$password = mysql_query('select customers_password from customers where customers_id='.$i);

$result = mysql_query('UPDATE customers SET customers_password="'.tep_encrypt_password($password).'" WHERE customers_id='.$i);

 

but didnt work :(

 

some advice....?

Link to comment
Share on other sites

The passwords are read only. You can't do what you are trying to do. All of the passwords will have to be re-entered manually.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

The passwords are read only. You can't do what you are trying to do. All of the passwords will have to be re-entered manually.

 

Jack

 

But the script wrote in the field.

The field password was 123456, and after I run the script, was b1bbf6771402e9cf3081abafb2fe707a:dc

 

The problem is, when I try log on with this costumer, the password dont match.

Link to comment
Share on other sites

the $password var holds the reference. You need to get the actual value for the password, first of all. So use something like mysql_fetch_array afterwards.

Link to comment
Share on other sites

But the script wrote in the field.

The field password was 123456, and after I run the script, was b1bbf6771402e9cf3081abafb2fe707a:dc

 

The problem is, when I try log on with this costumer, the password dont match.

It displays like that because it is encrypted. You can't use it. It is for comparison only. That's why when you click on Forgot Password on login, a new password is sent. The code cannot decrypt the old one.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

It displays like that because it is encrypted. You can't use it. It is for comparison only. That's why when you click on Forgot Password on login, a new password is sent. The code cannot decrypt the old one.

 

Jack

 

Jack,

 

I understand that is impossible do what I want.

But I dont understand how works this process.

well .. I thought...

The encriptation works in this way:

 

1)user send password

2)function encript plain password

3)write encripted password in database

 

Validate

1)user send plain password

2)function encript password

3)password encripted is compared with the database password

-----------------

Now my script works in this way importing plain password from a old database

 

1)plain password is imported and writed in database

2)script get plains password and encripted them

 

Validate

1)user send plain password

2)plain password is encripted and compared with database password

3)password doesnt match... :/

 

I dont understand why this doesn work :/

I know that is impossible decripte, but in this way I didnt decripte it.

 

Thanx for your atention

 

SniperFox

Link to comment
Share on other sites

The encryption algorithm is a write-once type. That means that if you encrypted the worh help a thousand times, you would get a thousand different results. Otherwise, the encryption would be useless since someone could do what you are doing and figure out the passwords.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Hello there!

 

I wanna convert my old customers table (from my old site) to the oscommerce customers table.

I tried it but I got a problem with passwords. My old table dont have encriptation. I write this script to encriptate the password in one record in the table:

 

$i=6; //record 6

$password = mysql_query('select customers_password from customers where customers_id='.$i);

$result = mysql_query('UPDATE customers SET customers_password="'.tep_encrypt_password($password).'" WHERE customers_id='.$i);

 

but didnt work :(

 

some advice....?

 

 

 

 

 

 

maybe this php script could help you

<?PHP

$old password='123456';

$mid=substr($old password,0,2);

$newpassword=md5($mid . $old password) . ':' . $mid;

?>

let me know if its working B)

Link to comment
Share on other sites

maybe this php script could help you

<?PHP

$old password='123456';

$mid=substr($old password,0,2);

$newpassword=md5($mid . $old password) . ':' . $mid;

?>

let me know if its working B)

 

thanx man! it work!

 

I just call the function that do it you writed

 

$newpassword = tep_encrypt_password($customers_query['password']);

 

and after it insert into...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...