Basicly I need something that repeats itself about 90,000 times.
The code is.
<?
include("ccval.php");
$Number = "5105 1051 0510 5100"; // MasterCard test number
$Result = ccval($Number);
if ($Result) {
Print "Good Card.";
}
else {
if (is_int($Result)) echo "Bad Date.";
else echo "Bad Number";
}
?>
CCVAL.php
// The Luhn formula works right to left, so reverse the number.
$Num = strrev($Num);
$Total = 0;
for ($x=0; $x<strlen($Num); $x++) {
$digit = substr($Num,$x,1);
// If it's an odd digit, double it
if ($x/2 != floor($x/2)) {
$digit *= 2;
// If the result is two digits, add them
if (strlen($digit) == 2)
$digit = substr($digit,0,1) + substr($digit,1,1);
}
// Add the current digit, doubled and added if applicable, to the Total
$Total += $digit;
}
// If it passed (or bypassed) the card-specific check and the Total is
// evenly divisible by 10, it's cool!
if ($GoodCard && $Total % 10 == 0) return true; else return false;
}
?>
I need $number to be replaced by a number from a .txt file , go through the ccval process then move on to the next number in the text file..
The text file looks like this.
93286892386236
26893869289623
32896892386232
96238968923689
32690389026923
But it has 90,000 numbers and I cannot enter each by myself. Thanks