PX : code

Creditcard Luhn-Check by mcmer
Download this code


<?php 
function cc_luhn_chk($u2i_cc) {
    for (
$i strlen($u2i_cc), $double_it true$i > -1$i $i-1) { 
        
$str_sub substr($u2i_cc$i1);
        if (
$double_it) {
            
$nbr_tmp $str_sub 2$double_it false;
        } else { 
$nbr_tmp $str_sub$double_it true; }
        if (
strlen($nbr_tmp) > 1) { $sum_total $sum_total substr($nbr_tmp01) + substr($nbr_tmp11);
        } else { 
$sum_total $sum_total $nbr_tmp; }
    } 
    if (
is_integer($sum_total/10)) { return true;
    } else { return 
false; }
}
?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.