'; ?> Universal Credit Card form give 1 */ if ($cclen%2==0) { $p=0; } /* PAIR */ else {$p=2;} /* ODD */ /* Get each number of the card and put it in an array */ for($a=0;$a!=$cclen;$a++){ $X[$a]=substr($cardnumber,$a,1); } /* Algorithm Mod10 */ for ($nume=($p/2);$nume!=$cclen-$p;$nume=$nume+2){ $X[$nume]=$X[$nume]*2; if ($X[$nume]>=10) { $X1=substr($X[$nume],0,1); $X2=substr($X[$nume],1,1); $X[$nume]=substr($X[$nume],0,1)+substr($X[$nume],1,1); } } /* Sums each value of the modificated array */ /* Check the result of the algorithm */ for ($i=0;$i!=$cclen;$i++){ $val=$val+$X[$i]; } /* Please note: if the second number of the result of algorithm is not 0 */ /* then the card is NOT valid */ if ($val==0) {$ERROR = "Please check the credit card number" ;} else { if (substr($val,1,1)!=0){ $valida="not";} echo ("The card: $cardnumber seems to be: $valida valid"); exit(); /* This condition in the case $card contains characters */ exit("Maybe the Card Number inserted contains characters ? Only numbers please!"); } } if ($ERROR) { echo "

" . $ERROR . "

"; } ?>
Full name
Card number
Expiry
Checkcode