diff --git a/docker-compose.yml b/docker-compose.yml index 2c57894..4659f4b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,7 @@ services: - DB_NAME=${DB_NAME} - DB_USER=${DB_USER} - DB_PASS=${DB_PASS} + - ADMIN_PASS=${ADMIN_PASS} depends_on: - db networks: diff --git a/docker/mysql/init.sql b/docker/mysql/init.sql index 970868a..ad7eda5 100644 --- a/docker/mysql/init.sql +++ b/docker/mysql/init.sql @@ -10,6 +10,7 @@ CREATE TABLE IF NOT EXISTS `contacts` ( `phone` VARCHAR(30), `subject` VARCHAR(255), `message` TEXT NOT NULL, + `is_read` TINYINT(1) NOT NULL DEFAULT 0, `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB; diff --git a/www/includes/db.php b/www/includes/db.php new file mode 100644 index 0000000..af90daf --- /dev/null +++ b/www/includes/db.php @@ -0,0 +1,35 @@ + PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + ] + ); + + // Auto-migrate: add is_read if the DB was initialised before this column existed + $col_exists = $pdo->query( + "SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'contacts' AND COLUMN_NAME = 'is_read'" + )->fetchColumn(); + + if (!$col_exists) { + $pdo->exec("ALTER TABLE contacts ADD COLUMN is_read TINYINT(1) NOT NULL DEFAULT 0"); + } + + return $pdo; +} diff --git a/www/index.php b/www/index.php index 8ef1c20..811d17a 100644 --- a/www/index.php +++ b/www/index.php @@ -2,6 +2,12 @@ // Simple front controller — expand routing here later $path = trim($_GET['path'] ?? '', '/'); +// Staff inbox — self-contained, no public header/footer +if ($path === 'staff-portal') { + require __DIR__ . '/pages/admin-inbox.php'; + exit; +} + // Map paths to page includes $pages = [ '' => 'pages/home.php', diff --git a/www/pages/admin-inbox.php b/www/pages/admin-inbox.php new file mode 100644 index 0000000..e23455c --- /dev/null +++ b/www/pages/admin-inbox.php @@ -0,0 +1,239 @@ + + + +
+ + +No messages yet. They'll show up here once someone submits the contact form.
+