Added cgi-bin folder
This commit is contained in:
53
cgi-bin/galerie.py
Normal file
53
cgi-bin/galerie.py
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import cgi
|
||||||
|
import cgitb
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from random import randint
|
||||||
|
|
||||||
|
cgitb.enable()
|
||||||
|
|
||||||
|
error = False
|
||||||
|
|
||||||
|
#try:
|
||||||
|
# # FieldStorage-Instanz erzeugen
|
||||||
|
# form = cgi.FieldStorage(encoding='utf8')
|
||||||
|
#
|
||||||
|
# # Zugriff auf die Parameter (nach Integer konvertieren!)
|
||||||
|
# s1 = int(form.getvalue('s1'))
|
||||||
|
# s2 = int(form.getvalue('s2'))
|
||||||
|
#
|
||||||
|
# # Summe berechnen
|
||||||
|
# my_sum = s1 + s2
|
||||||
|
#
|
||||||
|
#except:
|
||||||
|
# error = True
|
||||||
|
|
||||||
|
# Ausgabe
|
||||||
|
print("Content-type: text/html\n")
|
||||||
|
|
||||||
|
print("""
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Summenrechner</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
""")
|
||||||
|
|
||||||
|
randomnum = 3 * randint(1, 7)
|
||||||
|
|
||||||
|
count = 1
|
||||||
|
while count <= randomnum:
|
||||||
|
print(""" <img src="https://picsum.photos/800/600?random={}"> """.format(count))
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
|
||||||
|
print("""
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
""")
|
Reference in New Issue
Block a user