Le site web bebou.netlib.re - retour accueil
git clone git://bebou.netlib.re/bebou
Log | Files | Refs |
qr.cgi (1467B)
1 #! /bin/sh 2 3 if echo "$HTTP_ACCEPT" | grep -q "text/plain";then 4 contenttype="text/plain" 5 else 6 contenttype="text/html" 7 fi 8 9 printf "Content-Type: $contenttype\r\n" 10 printf "\r\n" 11 12 if echo "$QUERY_STRING" | grep -q "text=" ;then 13 base64="$(qrencode "${QUERY_STRING##'text='}" -s 15 -l H -o - | base64)" 14 res="<img src='data:image/png;base64,$base64'>" 15 fi 16 17 if [ "$contenttype" = "text/plain" ];then 18 echo "$base64" 19 else 20 <<-. cat 21 <!DOCTYPE html> 22 <html lang="fr"> 23 <head> 24 <meta charset="utf-8"> 25 <meta name="color-scheme" content="light dark"> 26 <meta name="viewport" content="width=device-width, initial-scale=1"> 27 <title>Vérificateur Scrabble</title> 28 <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🔤</text></svg>"> 29 <style> 30 * { box-sizing: border-box } 31 html { font: 1rem sans-serif } 32 body { height: 100vh; margin: 0; padding: 1rem; display: grid; place-items: center } 33 input { font: inherit; padding: .5em } 34 form { margin-inline: auto; width: fit-content; min-height: 6rem } 35 form > * { display: inline-block; margin-bottom: .5em } 36 </style> 37 </head> 38 <body> 39 <form> 40 <label for="text">Texte</label><br> 41 <input type="text" name="text" id="text" placeholder="Votre texte…" value="$text" required> 42 <input type="submit" value="Encoder"><br> 43 <output name="resultat" for="text">$res</output> 44 </form> 45 </body> 46 </html> 47 . 48 fi 49