Revert "Removed old stuff"

This reverts commit 45e66ca7e6.
This commit is contained in:
2025-12-20 05:27:10 +01:00
parent 45e66ca7e6
commit 782e608db4
6 changed files with 67 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
import sqlite3
from flask import render_template
from __main__ import app
@app.route("/database")
def database():
con = sqlite3.connect("kver.db")
cursor = con.cursor()
# cursor.execute("INSERT INTO movie VALUES (?, ?, ?)", ("Erster Film", 1900, 8.2))
# con.commit()
res = cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
return render_template("database.html", tables=res.fetchall())
# !!! USER VALUE IN SQL STATEMENT !!!
@app.route("/database/<table>")
def db_table(table):
con = sqlite3.connect("kver.db")
cursor = con.cursor()
# cursor.execute("INSERT INTO movie VALUES (?, ?, ?)", ("Erster Film", 1900, 8.2))
# con.commit()
# columns = cursor.execute("SELECT sql FROM sqlite_master WHERE type='table' AND name=?;", [table])
# !!! USER VALUE IN SQL-STATEMENT !!!
data = cursor.execute(f"SELECT * FROM {table};")
return render_template("database_table.html", data=data.fetchall())
+36
View File
@@ -0,0 +1,36 @@
import os
from PIL import Image
from flask import request, render_template
from __main__ import app
@app.route("/upload", methods=['GET', 'POST'])
def upload():
state="Nothing done..."
success=False
if request.method == 'POST':
if 'file' not in request.files:
state='No file'
file = request.files['file']
if file.filename == '':
state="No File selected!"
if file:
filename = "uploadedfile"
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
state="File uploaded!"
success=True
imagedata = []
if success:
try:
i = Image.open("uploads/uploadedfile")
imagedata.append(i.format)
imagedata.append(i.size)
except Exception as e:
imagedata.append(e)
return render_template("upload.html", state=state, imagedata=imagedata)
Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB