選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # coding: utf-8
  2. import cgi
  3. import cgitb; cgitb.enable()
  4. import glob
  5. form = cgi.FieldStorage()
  6. print("Content-type: text/html; charset=utf-8\n")
  7. header = """
  8. <!DOCTYPE html>
  9. <head>
  10. <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
  11. <title>Simple Image Uploader</title>
  12. </head>
  13. <body>
  14. """
  15. print(header)
  16. password = form.getvalue("password")
  17. choix = form.getvalue("choice")
  18. if str(password) == "TheBidouilleur" and choix is None:
  19. print("""<h2 class="w3-center w3-teal"> Choose a directory </h2>""")
  20. print("""<h3 class="w3-center">Choose a directory </h3>""")
  21. Choix = """
  22. <title> Choix des photos </title>
  23. <form action="./login.py" method="post" class="w3-container">
  24. <select class="w3-select" name="choice">
  25. <option value="" disabled selected>Selectionnez une option</option>
  26. <option value="Cities">Cities</option>
  27. <option value="Beaches">Beaches</option>
  28. <option value="Mountains">Mountains</option>
  29. <option value="Skies">Skies</option>
  30. </select>
  31. <br>
  32. <input type="submit" name="send" value="Check photos" class="w3-btn w3-teal">
  33. </form>"""
  34. print(Choix)
  35. elif str(password) != "TheBidouilleur" and password is not None and choix is None :
  36. print("""<h2 class="w3-center w3-teal"> Connexion </h2>""")
  37. print("""<div class="w3-panel w3-red">
  38. <h2 class="w3-opacity">Bad password ! </h2>
  39. </div>
  40. """)
  41. formulaire = """<form action="./login.py" method="post" class="w3-container">
  42. <h3>Log in to access the page </h3>
  43. <br>
  44. <input class="w3-input" type="password" name="password" value="" />
  45. <br>
  46. <input type="submit" name="send" value="Login" class="w3-btn w3-teal">
  47. <br>
  48. </form>"""
  49. print(formulaire)
  50. elif choix is None :
  51. print("""<h2 class="w3-center w3-teal"> Connexion </h2>""")
  52. formulaire ="""<form action="./login.py" method="post" class="w3-container">
  53. <h3> Log in to access the page </h3>
  54. <br>
  55. <input class="w3-input" type="password" name="password" value="" />
  56. <br>
  57. <input type="submit" name="send" value="Login" class="w3-btn w3-teal">
  58. <br>
  59. </form>"""
  60. print(formulaire)
  61. if choix is not None :
  62. if choix == "Beaches":
  63. print("""<h2 class="w3-center w3-teal"> Beaches</h2>""")
  64. file = glob.glob("Beaches/*")
  65. if choix == "Cities":
  66. print("""<h2 class="w3-center w3-teal"> Cities </h2>""")
  67. file = glob.glob("Cities/*")
  68. if choix == "Skies":
  69. print("""<h2 class="w3-center w3-teal"> Skies</h2>""")
  70. file = glob.glob("Skies/*")
  71. if choix == "Mountains":
  72. print("""<h2 class="w3-center w3-teal"> Mountains </h2>""")
  73. file = glob.glob("Mountains/*")
  74. print("<div class='w3-container'>")
  75. for i in range(len(file)):
  76. print("<img class='w3-round' width=200px src='" + file[i] + "'>")
  77. end = """
  78. </body>
  79. </html>
  80. """
  81. print(end)