Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with Enrcypting Password


madhungarian

Recommended Posts

Posted

Was trying to take my own current member db and integrate with OS Commerce. Problem I am running into is encryption of the passwords. I have created a generic page where new members to my business can take advantage of a coupon for in store discount and I would like this customer information to be transferred into the Os Commerce app in order to reduce duplications. Problem that I am having is getting the OS Commerce Password Encryption function to work in the coupon page.

I have the function in the head on the coupon page and call the function onChange with the text input box. The form submit goes to a seperate handler that sends out an email, inputs the data into the appropirate db & tables, and then creates the coupon for individuals to print & bring into the store. Appropriate code is listed below. Any insight would be greatly appreciated. TIA.

 

<?

// This function makes a new password from a plaintext password.

function tep_encrypt_password(plain) {

password = '';

for ($i=0; $i<10; $i++) {

password .= tep_rand();

}

$salt = substr(md5($password), 0, 2);

password = md5($salt . plain) . ':' . $salt;

return password;

}

?>

 

//Password Input Row in Form

 

<td width="14%"><input type="text" name="plain" onChange="tep_encrypt_password(plain);" size="15"></td>

 

//Form handler page that is called on submit that inputs into DB

 

$query = "INSERT INTO customers (customers_gender,customers_firstname,customers_lastname,customers_dob,customers

_email_address,customers_telephone, customers_password, customers_newsletter) VALUES ('$gender','$firstname','$lastname','$dob','$email_address','$telephone', '$password','$newsletter')";

Posted

Once I put down the Bass Ales I was able to see that I had stupidly left out defining the encryption password function. Took care of that and then ran into the problem of having to ensure that both the customers and address_book tables were linked by common customer_id field. Got that hammered away and now I'm golden.

 

A BIG SHOUT OUT to Silencer for the help, as most people dont even take the time to try and shed a little light.

 

Cheers

Archived

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

×
×
  • Create New...