Morpheusweb.it - Risorse per webmaster: script, ASP.NET, C#, Visual Basic .Net, tutorial, asp, javascript, css, php, html, java, ADO, VBScript, forms, frames, Active Server Pages, Dynamic HTML, database, gratis per webmaster e webdesigner

Credit Card Validator

Script per la validazione delle carte di credito.




<?php
function CCVal($Num, $Name = 'n/a') {
$GoodCard = true;
$Num = ereg_replace("[^[:digit:]]", "", $Num);
switch ($Name) {
case "mcd" :
    $GoodCard = ereg("^5[1-5].{14}$", $Num);
    break;
case "vis" :
    $GoodCard = ereg("^4.{15}$|^4.{12}$", $Num);
    break;
case "amx" :
    $GoodCard = ereg("^3[47].{13}$", $Num);
    break;
case "dsc" :
    $GoodCard = ereg("^6011.{12}$", $Num);
    break;
case "dnc" :
    $GoodCard = ereg("^30[0-5].{11}$|^3[68].{12}$", $Num);
    break;
case "jcb" :
    $GoodCard = ereg("^3.{15}$|^2131|1800.{11}$", $Num);
    break;
}
$Num = strrev($Num);
$Total = 0;
for ($x=0; $x<strlen($Num); $x++) {
    $digit = substr($Num,$x,1);
    if ($x/2 != floor($x/2)) {
        $digit *= 2;
        if (strlen($digit) == 2)
            $digit = substr($digit,0,1) + substr($digit,1,1);
        }
        $Total += $digit;
    }
    if ($GoodCard && $Total % 10 == 0) return true; else return false;
}
?>


Scarica il Codice...


Stampa la pagina


 








Inizio pagina

risorse per webmaster

php

php

php, mail, database, banner
php, banner,

Vai nel sito Morpheusweb.it - Risorse per Webmaster troverai quello che stai cercando
php, banner,
Nel nostro sito molte informazioni: "Morpheusweb.it - Risorse per Webmaster" tratta di php, script, forms, mail, database
click here se non sei reindirizzato automaticamente al nostro sito.

php, script, banner, mail, database, , ,