From b56f3fb4333b60cc8802bb14c70c2ecc73041907 Mon Sep 17 00:00:00 2001 From: vista-man <524715@vistacollege.nl> Date: Thu, 3 Apr 2025 10:27:29 +0200 Subject: [PATCH] add ticket purchase form, employee login, and database schema --- database.sql | 35 +++++++++++++++++++++++++++++++++++ employee-login.html | 44 ++++++++++++++++++++++++++++++++++++++++++++ index.html | 28 +++++++++++++++++++++++++++- script.js | 25 +++++++++++++++++++++++++ style.css | 8 ++++++++ 5 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 database.sql create mode 100644 employee-login.html diff --git a/database.sql b/database.sql new file mode 100644 index 0000000..5bf3c32 --- /dev/null +++ b/database.sql @@ -0,0 +1,35 @@ +-- Create the database +CREATE DATABASE IF NOT EXISTS spik_en_span; +USE spik_en_span; + +-- Table for storing ticket information +CREATE TABLE tickets ( + id INT AUTO_INCREMENT PRIMARY KEY, + ticket_id VARCHAR(255) NOT NULL UNIQUE, + name VARCHAR(255) NOT NULL, + email VARCHAR(255) NOT NULL, + category ENUM('adult', 'child', 'group') NOT NULL, + quantity INT NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +-- Table for storing employee login credentials +CREATE TABLE employees ( + id INT AUTO_INCREMENT PRIMARY KEY, + username VARCHAR(255) NOT NULL UNIQUE, + password_hash VARCHAR(255) NOT NULL, -- Store hashed passwords + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +-- Table for storing scanned ticket logs +CREATE TABLE scanned_tickets ( + id INT AUTO_INCREMENT PRIMARY KEY, + ticket_id VARCHAR(255) NOT NULL, + scanned_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + is_valid BOOLEAN NOT NULL DEFAULT TRUE, + UNIQUE (ticket_id) +); + +-- Insert a default employee account (username: admin, password: password) +INSERT INTO employees (username, password_hash) +VALUES ('admin', SHA2('password', 256)); -- Replace with a secure password hashing method diff --git a/employee-login.html b/employee-login.html new file mode 100644 index 0000000..9e92785 --- /dev/null +++ b/employee-login.html @@ -0,0 +1,44 @@ + + +
+ + +