PHP Card Number Generator: Difference between revisions
From D3xt3r01.tk
Jump to navigationJump to search
(Created page with "==WHY== Because some sites offer free trials .. you don't want them to charge just for trying .. or you just want to be anonymous ! ==HOW== <source lang="php"> function gen...") |
(No difference)
|
Latest revision as of 16:27, 28 June 2013
WHY
Because some sites offer free trials .. you don't want them to charge just for trying .. or you just want to be anonymous !
HOW
function gen_card(){
$rand = array();
$rand[] = "4";
for($i=0;$i<14;$i++){
$rand[] = rand(0,9);
}
$orig = $rand;
$rand_rev = array_reverse($rand);
foreach($rand_rev as $cnt => $nr){
if($cnt%2 == 0){
$rand_rev[$cnt] = $nr*2;
if($rand_rev[$cnt] >= 10){
$nr = str_split($rand_rev[$cnt]);
$rand_rev[$cnt] = $nr[0] + $nr[1];
}
}
}
$rand = array_reverse($rand_rev);
$sum = array_sum($rand) * 9;
$orig = implode('', $orig);
$sum = str_split($sum);
$nr = $sum[count($sum)-1];
return $orig.$nr;
}