<?php
if(isset($submit))
{
// Verbindung zur DB aufnehemen
include("db.inc.php");
include("class_permutation.php");
################################################################################
$basis = "4044515";
$Array = permutations("1234567890",5);
echo "<table border='0' cellpadding=0 cellspacing=0><tr><td>";
for($i=0 ; $i < count($Array) ; $i++) {
$s=(string)$Array[$i];
$c_basis = 33;
$c_a = $s{0}*3;
$c_b = $s{1};
$c_c = $s{2}*3;
$c_d = $s{3};
$c_e = $s{4}*3;
$calc = $c_basis+$c_a+$c_b+$c_c+$c_d+$c_e;
$finalcalc = (10-($calc%10))%10;
echo "$basis<b>$Array[$i]<font color='#ff0000'>$finalcalc</font></b><br>"or die ("FEHLER BEI DER ANZEIGE");
//mysql_query("INSERT INTO ean (barcode) VALUES ('$basis$Array[$i]$finalcalc')")or die ("Fehler:<br>".mysql_error());
//mysql_query("UPDATE ean (barcode) VALUES ('$basis$Array[$i]$finalcalc')")or die ("Fehler:<br>".mysql_error());
}
echo "</td></tr></table>";
}else{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h3>Permutation EAN13-Codes</h3>
Nach drücken des nachfolgenden Buttons "EAN einfügen" werden 100.000 Barcodevariationen mit Prüfziffer<br>
in die Datenbank geschrieben.<br>
<br>
Es existiert eine Abfrage auf doppelte Barcodes, sodas ein unnötiges mehrmaliges einfügen verhindert wird!
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">
<input name="submit" type="submit" value="EAN einfügen">
</form>
</body>
</html>
<?php } ?>