Nie możesz wybrać więcej, niż 25 tematów
Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
|
- # coding: utf-8
-
- import cgi
- import cgitb; cgitb.enable()
- import glob
- form = cgi.FieldStorage()
- print("Content-type: text/html; charset=utf-8\n")
-
- header = """
- <!DOCTYPE html>
- <head>
- <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
- <title>Simple Image Uploader</title>
- </head>
- <body>
-
- """
-
- print(header)
-
- password = form.getvalue("password")
- choix = form.getvalue("choice")
-
- if str(password) == "TheBidouilleur" and choix is None:
- print("""<h2 class="w3-center w3-teal"> Choose a directory </h2>""")
- print("""<h3 class="w3-center">Choose a directory </h3>""")
- Choix = """
- <title> Choix des photos </title>
- <form action="./login.py" method="post" class="w3-container">
- <select class="w3-select" name="choice">
- <option value="" disabled selected>Selectionnez une option</option>
- <option value="Cities">Cities</option>
- <option value="Beaches">Beaches</option>
- <option value="Mountains">Mountains</option>
- <option value="Skies">Skies</option>
- </select>
- <br>
- <input type="submit" name="send" value="Check photos" class="w3-btn w3-teal">
- </form>"""
- print(Choix)
-
- elif str(password) != "TheBidouilleur" and password is not None and choix is None :
- print("""<h2 class="w3-center w3-teal"> Connexion </h2>""")
- print("""<div class="w3-panel w3-red">
- <h2 class="w3-opacity">Bad password ! </h2>
- </div>
- """)
- formulaire = """<form action="./login.py" method="post" class="w3-container">
- <h3>Log in to access the page </h3>
- <br>
- <input class="w3-input" type="password" name="password" value="" />
- <br>
- <input type="submit" name="send" value="Login" class="w3-btn w3-teal">
- <br>
- </form>"""
- print(formulaire)
- elif choix is None :
- print("""<h2 class="w3-center w3-teal"> Connexion </h2>""")
- formulaire ="""<form action="./login.py" method="post" class="w3-container">
- <h3> Log in to access the page </h3>
- <br>
- <input class="w3-input" type="password" name="password" value="" />
- <br>
- <input type="submit" name="send" value="Login" class="w3-btn w3-teal">
- <br>
- </form>"""
- print(formulaire)
-
- if choix is not None :
- if choix == "Beaches":
- print("""<h2 class="w3-center w3-teal"> Beaches</h2>""")
- file = glob.glob("Beaches/*")
- if choix == "Cities":
- print("""<h2 class="w3-center w3-teal"> Cities </h2>""")
- file = glob.glob("Cities/*")
- if choix == "Skies":
- print("""<h2 class="w3-center w3-teal"> Skies</h2>""")
- file = glob.glob("Skies/*")
- if choix == "Mountains":
- print("""<h2 class="w3-center w3-teal"> Mountains </h2>""")
- file = glob.glob("Mountains/*")
-
- print("<div class='w3-container'>")
- for i in range(len(file)):
- print("<img class='w3-round' width=200px src='" + file[i] + "'>")
-
-
- end = """
- </body>
- </html>
- """
-
- print(end)
|