Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

95 Zeilen
3.4 KiB

  1. # coding: utf-8
  2. import cgi
  3. import cgitb; cgitb.enable()
  4. import glob
  5. form = cgi.FieldStorage()
  6. header = """
  7. <!DOCTYPE html>
  8. <head>
  9. <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
  10. <title>Envoyer une image</title>
  11. </head>
  12. <body>
  13. """
  14. print(header)
  15. password = form.getvalue("password")
  16. link = form.getvalue("link")
  17. choice = form.getvalue("choice")
  18. if link is not None :
  19. print("""<h2 class="w3-center w3-teal"> Confirmation </h2>""")
  20. print("""<h3 class="w3-left">Do you want to add this image to the """ + str(form.getvalue("choice")) + """ folder ? </h3> <br> <br>""" )
  21. print("<img class='w3-round' width=200px src='" + str(link) + "'>")
  22. formulaire = """<form action="download.py" method="post" class="w3-container"> """
  23. formulaire += "<p class='w3-wide'> Link </p>"
  24. formulaire += """ <input class="w3-input" type="text" name="link" value='"""
  25. formulaire += str(link) + "'"
  26. formulaire += ' > <br> <br>'
  27. formulaire += "<p class='w3-wide'> Folder </p>"
  28. formulaire += """ <input class="w3-input" type="text" name="choice" value='"""
  29. formulaire += str(choice) + "'"
  30. formulaire += ' " > <br> <br>'
  31. formulaire += '<input type="submit" value="Ok!" class="w3-btn w3-teal">'
  32. formulaire += '</form>'
  33. print(formulaire)
  34. else :
  35. if password is None:
  36. print("""<h2 class="w3-center w3-teal"> Send a picture </h2>""")
  37. formulaire ="""<form action="./upload.py" method="post" class="w3-container">
  38. <h3> Login </h3>
  39. <br>
  40. <input class="w3-input" type="password" name="password" value="" />
  41. <br>
  42. <input type="submit" name="send" value="Login" class="w3-btn w3-teal">
  43. <br>
  44. </form>"""
  45. print(formulaire)
  46. if str(password) == "TheBidouilleur" and link is None:
  47. print("""<h2 class="w3-center w3-teal"> Choose the folder </h2>""")
  48. print("""<h3 class="w3-center">Please choose a folder </h3>""")
  49. choice = """
  50. <title> choice des photos </title>
  51. <form action="./upload.py" method="post" class="w3-container">
  52. <select class="w3-select" name="choice">
  53. <option value="" disabled selected>Select a folder</option>
  54. <option value="Cities">Cities</option>
  55. <option value="Beaches">Beaches</option>
  56. <option value="Mountains">Mountains</option>
  57. <option value="Skies">Skies</option>
  58. </select>
  59. <br>
  60. <input class="w3-input" type="text" name="link" value="https://link_of_the/image.png" required>
  61. <br>
  62. <input type="submit" name="send" value="Download the photo" class="w3-btn w3-teal">
  63. </form>"""
  64. print(choice)
  65. elif str(password) != "TheBidouilleur" and password is not None and link is None:
  66. print("""<h2 class="w3-center w3-teal"> Connexion </h2>""")
  67. print("""<div class="w3-panel w3-red">
  68. <h2 class="w3-opacity">Mauvais MDP ! </h2>
  69. </div>
  70. """)
  71. formulaire ="""<form action="./upload.py" method="post" class="w3-container">
  72. <h3>Please enter password </h3>
  73. <br>
  74. <input class="w3-input" type="password" name="password" value="" />
  75. <br>
  76. <input type="submit" name="send" value="Login" class="w3-btn w3-teal">
  77. <br>
  78. </form>"""
  79. print(formulaire)
  80. end = """
  81. </body>
  82. </html>
  83. """
  84. print(end)