Guest User

Untitled

a guest
Jun 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <form action="<?=$_SERVER['PHP_SELF']?>" method="get">
  2. ISBN [ohne Bindestriche] <input type="text" name="isbn" value="<?=isset($_GET['isbn'])?$_GET['isbn']:"";?>"> </br>
  3. <input type="radio" name="EAN" value="10" checked>10 Stellig</br>
  4. <input type="radio" name="EAN" value="13" disabled>13 Stellig</br>
  5. <input type="submit" name="button" value="Prüfsumme">
  6. </form>
  7.  
  8. <?php
  9. if(isset($_GET['button'], $_GET['EAN'])) {
  10. $isbn=preg_replace("/[^0-9]/", '', $text);
  11. $i=$_GET['EAN'];
  12. $pruef_summe=0;
  13. if (strlen($isbn)==$i) {
  14. echo 'Eingegebene Prüfsumme: <b>',$pp=$isbn[9],'</b><Br>';
  15. for ($j=0;$j<=8;$j++) {
  16. $pruef_summe += ($isbn[$j]*$i);
  17. $i--;
  18. }
  19. $divi=$pruef_summe%11;
  20. if (11-$divi==10) $pp==0;
  21. if (11-$divi==$pp) echo 'Prüfsumme: <font color="green"><b>OK!</b></font>';
  22. else echo 'Prüfsumme: <font color="red"><b>Falsch!</b></font>';
  23. } else {
  24. echo '<font color="blue"></b>Anzahl Ziffern für gewählten ISBN Modus nicht korrekt</font></b>';
  25. }
  26. }
  27. ?>
Add Comment
Please, Sign In to add comment