Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="<?=$_SERVER['PHP_SELF']?>" method="get">
- ISBN [ohne Bindestriche] <input type="text" name="isbn" value="<?=isset($_GET['isbn'])?$_GET['isbn']:"";?>"> </br>
- <input type="radio" name="EAN" value="10" checked>10 Stellig</br>
- <input type="radio" name="EAN" value="13" disabled>13 Stellig</br>
- <input type="submit" name="button" value="Prüfsumme">
- </form>
- <?php
- if(isset($_GET['button'], $_GET['EAN'])) {
- $isbn=preg_replace("/[^0-9]/", '', $text);
- $i=$_GET['EAN'];
- $pruef_summe=0;
- if (strlen($isbn)==$i) {
- echo 'Eingegebene Prüfsumme: <b>',$pp=$isbn[9],'</b><Br>';
- for ($j=0;$j<=8;$j++) {
- $pruef_summe += ($isbn[$j]*$i);
- $i--;
- }
- $divi=$pruef_summe%11;
- if (11-$divi==10) $pp==0;
- if (11-$divi==$pp) echo 'Prüfsumme: <font color="green"><b>OK!</b></font>';
- else echo 'Prüfsumme: <font color="red"><b>Falsch!</b></font>';
- } else {
- echo '<font color="blue"></b>Anzahl Ziffern für gewählten ISBN Modus nicht korrekt</font></b>';
- }
- }
- ?>
Add Comment
Please, Sign In to add comment