diff --git a/server.py b/server.py index 5dacb31..311fbd1 100644 --- a/server.py +++ b/server.py @@ -57,6 +57,24 @@ def init_users_table(): conn.commit() print("Default admin user created - username: admin, password: admin123") + +def init_logs_table(): + """Initialize the logs table if it doesn't exist""" + with sqlite3.connect(DATABASE) as conn: + cursor = conn.cursor() + cursor.execute(''' + CREATE TABLE IF NOT EXISTS logs ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + hostname TEXT NOT NULL, + device_ip TEXT NOT NULL, + nume_masa TEXT NOT NULL, + timestamp TEXT NOT NULL, + event_description TEXT NOT NULL + ) + ''') + conn.commit() + print("Logs table initialized") + # Login route @app.route('/login', methods=['GET', 'POST']) def login(): @@ -559,4 +577,5 @@ def database_stats(): if __name__ == '__main__': init_users_table() + init_logs_table() app.run(host='0.0.0.0', port=80) \ No newline at end of file