Contributions

Credit Modules (Category Index)
Search: 

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

Fix for those using cc encryption 19 Jan 2009

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']."&nbsp;</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']."&nbsp;</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

Clean_cc_number 1.2 11 Nov 2008
Clean_cc_number 10 Aug 2006
Credit Card numbers cleaner Federico Jacobi 30 Dec 2004

Note: Contributions are used at own risk.