Contributions
Credit Card numbers cleaner
Credit Card number cleaner replaces with XXX the first digits of all the credit card numbers stored in the database, leaving only the last 4 digits available as a reference. It processes not one, but all the orders that are not "Pending". "Pending" orders are left as they are.
This script uses OsCommerce style, file structure, and names. It should work in many versions.
If you have any question, find a bug, or want to improve the script feel free to contact me at federico_jacobi@yahoo.com
LANGUAGES: english and spanish.
Expand All / Collapse All
For those using the Credit Card Number Encryption contribution (http://addons.oscommerce.com/info/4359), you'll need to modify your code as follows:
Find the section of code in /catalog/admin/clean_cc_numbers.php:
while ($orders = tep_db_fetch_array($orders_query)) {
$newNum = 'XXXXXXXXXXXX';
$newNum .= substr($orders['cc_number'], strlen($orders['cc_number'])-4);
echo "<tr><td align='right'>".$orders['orders_id']." </td><td>".$newNum."</td><td>".substr($orders['date_purchased'],0,-8)."</td><td align='center'>".$orders['orders_status']."</td></tr>";
// Uncommenting the line below will ACTIVATE the script
//tep_db_query("update " . TABLE_ORDERS . " set cc_number='".$newNum."' where orders_id=".$orders['orders_id'].";");
}
And replace with:
while ($orders = tep_db_fetch_array($orders_query)) {
$newNum = 'XXXXXXXXXXXX';
// Credit Card Number Decryption
// check for encryption status and if credit card number exist decrypt
if ((USE_ENCRYPTION == true) && (tep_not_null($orders['cc_number'])) && (strlen($orders['cc_number']) > 19) ) {
$cc_new_value = md5_decrypt($orders['cc_number'], TEXT_ENCRYPTION_PW, $iv_len = 16);
} else {
$cc_new_value = $orders['cc_number'];
}
$newNum .= substr($cc_new_value, strlen($cc_new_value)-4);
echo "<tr><td align='right'>".$orders['orders_id']." </td><td>".$newNum."</td><td>".substr($orders['date_purchased'],0,-8)."</td><td align='center'>".$orders['orders_status']."</td></tr>";
// Uncommenting the line below will ACTIVATE the script
//tep_db_query("update " . TABLE_ORDERS . " set cc_number='".$newNum."' where orders_id=".$orders['orders_id'].";");
}
--------------------------------
Thanks. Great Contrib!
Other things I'd suggest others consider - on our site, we are contemplating
that across ALL orders. I cannot think of a use case where the cc number should be cleansed
regardless of order status.
Also, I'd prefer if there was some way for this script to be automated (run once daily)
Attached File just contains what I have posted
- Now does not re-clean previously cleaned records. Slightly more processing for less database access.
- Output is now a table for better readability.
Please be aware that lines are commented out as a safety feature. You may remove the "//" after testing to ACTIVATE the script.
I skipped v.1.0!
Version 1.1 brings you the choice to select credit card numbers to clear by their order status and how old they are. So you can X out card numbers where orders were "shipped" and are more than "7" days old.
Please be aware that lines are commented out as a safety feature. You may remove the "//" after testing to ACTIVATE the script.
Now also includes Japanese files.
Credit Card number cleaner replaces with XXX the first digits of all the credit card numbers stored in the database, leaving only the last 4 digits available as a reference. It processes not one, but all the orders that are not "Pending". "Pending" orders are left as they are.
This script uses OsCommerce style, file structure, and names. It should work in many versions.
If you have any question, find a bug, or want to improve the script feel free to contact me at federico_jacobi@yahoo.com
LANGUAGES: english and spanish.
Note: Contributions are used at own risk.