function popup($ibanField, $bicField) { $F = new HTMLForm("ibanCalc", array("land", "kontonummer", "bankleitzahl", "ibanField", "bicField")); $F->getTable()->setColWidth(1, 120); $I = new IBAN(); $l = array(); foreach ($I->Countries() as $c) { $IC = new IBANCountry($c); if (!$IC->IsSEPA()) { continue; } $l[$c] = ISO3166::getCountryToCode($c) . " ({$c})"; } asort($l); $F->setType("land", "select", "DE", $l); $F->setType("ibanField", "hidden"); $F->setType("bicField", "hidden"); $F->setValue("ibanField", $ibanField); $F->setValue("bicField", $bicField); $F->setSaveRMEPCR("Berechnen", "", "IBANCalc", "-1", "calc", "function(t){ \$j('#ibanCalcResult').html(t.responseText); }"); echo $F . "<div id=\"ibanCalcResult\"></div>"; }
#$parts = $myIban->Parts(); #print_r($parts); # verify print "\nChecking validity... "; if ($myIban->Verify()) { print "IBAN {$myIban->iban} is valid.\n"; } else { print "ERROR: IBAN {$myIban->iban} is invalid.\n"; $correct = $myIban->SetChecksum(); if ($correct == $iban) { print " (checksum is correct, structure must have issues.)\n"; $machine_iban = $myIban->MachineFormat(); print " (machine format is: '{$machine_iban}')\n"; $country = $myIban->Country(); print " (country is: '{$country}')\n"; $myCountry = new IBANCountry($country); if (strlen($machine_iban) != $myCountry->IBANLength()) { print " (ERROR: length of '" . strlen($machine_iban) . "' does not match expected length for country's IBAN '" . $myCountry->IBANLength() . "'.)"; } $regex = '/' . $myCountry->IBANFormatRegex() . '/'; if (!preg_match($regex, $machine_iban)) { print " (ERROR: did not match regular expression '" . $regex . "')\n"; } } else { print " (correct checksum version would be '" . $correct . "')\n"; } $errors++; } print "\n"; } exit($errors);
public function __construct($code = '') { parent::__construct($code); _iban_load_registry(); }
# init $errors = 0; # Try to validate an invalid IBAN $iban = "(@#(*@*ZV-This is NOT an IBAN!"; $myIban = new IBAN($iban); if ($myIban->verify()) { print "ERROR: An invalid IBAN was validated!\n"; $errors++; } print "Hooray! - Invalid IBAN successfully rejected.\n\n"; # Get list of countries $countries = $myIban->Countries(); # Loop through the registry's examples, validating foreach ($countries as $countrycode) { # instantiate $myCountry = new IBANCountry($countrycode); # start section print "[{$countrycode}: " . $myCountry->Name() . "]\n"; # output remaining country properties print "Is a SEPA member? "; if ($myCountry->IsSEPA()) { print "Yes"; } else { print "No"; } print ".\n"; # get example iban $myIban = new IBAN($myCountry->IBANExample()); # output example iban properties one by one print "Example IBAN: " . $myIban->HumanFormat() . "\n"; print " - country " . $myIban->Country() . "\n";