diff --git a/index.php b/index.php index 89d44ba..b3416e6 100644 --- a/index.php +++ b/index.php @@ -37,6 +37,13 @@ $router->set404(function () { // Static route: / (homepage) $router->get('/', function(){ + $settings = \RedBeanPHP\R::load('settings', 1); + $tickets = $settings->value; + + if ($tickets <= 0) { + header('Location: /sold-out'); + } + include 'views/common/head.php'; include 'views/family.php'; include 'views/common/footer.php'; @@ -172,6 +179,12 @@ $router->get('/thank-you/{uuid}', function ($uuid) { include 'views/common/footer.php'; }); +$router->get('/sold-out', function () { + include 'views/common/head.php'; + include 'views/soldout.php'; + include 'views/common/footer.php'; +}); + $router->post('/manage/{uuid}', function ($uuid) { if ($uuid !== $_POST['uuid']) { throw new Exception('Invalid form submission', 400); diff --git a/views/common/head.php b/views/common/head.php index bac572a..b573866 100644 --- a/views/common/head.php +++ b/views/common/head.php @@ -45,6 +45,7 @@ value; + ?>
We are sold out of tickets!
+