import sqlite3 import os import http.cookies import time print("Content-Type: text/html") print() # Get the session ID from the cookie cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE")) session_id = cookie.get('session_id') if session_id: session_id = session_id.value # Connect to SQLite and check the session db = sqlite3.connect('/var/lib/monotreme/data/monotreme.db') cursor = db.cursor() # Check if the session exists and is still valid cursor.execute("SELECT username FROM sessions WHERE session_id=? AND expires_at > ?", (session_id, int(time.time()))) result = cursor.fetchone() if result: username = result[0] print(f"
This is your user panel.
") else: print("