index.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. $msg = isset($_GET['msg']) ? $_GET['msg'] : '';
  3. if (!$msg) $msg = "Le site du spipu\r\nhttp://spipu.net/";
  4. $err = isset($_GET['err']) ? $_GET['err'] : '';
  5. if (!in_array($err, array('L', 'M', 'Q', 'H'))) $err = 'L';
  6. require_once('qrcode.class.php');
  7. ?>
  8. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  9. <html>
  10. <head>
  11. <title>Spipu Qrcode <?php echo __CLASS_QRCODE__; ?></title>
  12. <meta name="Title" content="Spipu - Qrcode <?php echo __CLASS_QRCODE__; ?>" >
  13. <meta name="Description" content="Spipu - Qrcode <?php echo __CLASS_QRCODE__; ?>" >
  14. <meta name="Keywords" content="spipu">
  15. <meta name="Author" content="spipu" >
  16. <meta name="Reply-to" content="webmaster@spipu.net" >
  17. <meta name="Copyright" content="(c)2009 Spipu" >
  18. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" >
  19. <style type="text/css">
  20. <!--
  21. table.qr
  22. {
  23. border-collapse: collapse;
  24. border: solid 1px black;
  25. table-layout: fixed;
  26. }
  27. table.qr td
  28. {
  29. width: 5px;
  30. height: 5px;
  31. font-size: 2px;
  32. }
  33. table.qr td.on
  34. {
  35. background: #000000;
  36. }
  37. -->
  38. </style>
  39. </head>
  40. <body>
  41. <center>
  42. <form method="GET" action="">
  43. <textarea name="msg" cols="40" rows="7"><?php echo htmlentities($msg); ?></textarea><br>
  44. Correction d'erreur :
  45. <select name="err">
  46. <option value="L" <?php echo $err=='L' ? 'selected' : ''; ?>>L</option>
  47. <option value="M" <?php echo $err=='M' ? 'selected' : ''; ?>>M</option>
  48. <option value="Q" <?php echo $err=='Q' ? 'selected' : ''; ?>>Q</option>
  49. <option value="H" <?php echo $err=='H' ? 'selected' : ''; ?>>H</option>
  50. </select> |
  51. <input type="submit" value="Afficher">
  52. </form>
  53. <hr>
  54. Génération d'un tableau HTML :<br>
  55. <?php
  56. $qrcode = new QRcode(utf8_encode($msg), $err);
  57. $qrcode->displayHTML();
  58. ?>
  59. <br>
  60. Génération d'une image PNG : <br>
  61. <img src="./image.php?msg=<?php echo urlencode($msg); ?>&amp;err=<?php echo urlencode($err); ?>" alt="generation qr-code" style="border: solid 1px black;">
  62. </center>
  63. </body>
  64. </html>