From 23ce4bb268d73493dd1239891a1f2ca6b487f066 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 7 Mar 2019 16:21:44 -0600 Subject: [PATCH] ticket check/sold out check --- index.php | 13 +++++++++++++ views/common/head.php | 1 + views/soldout.php | 11 +++++++++++ 3 files changed, 25 insertions(+) create mode 100644 views/soldout.php 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; + ?>
diff --git a/views/soldout.php b/views/soldout.php new file mode 100644 index 0000000..849a012 --- /dev/null +++ b/views/soldout.php @@ -0,0 +1,11 @@ +
+
+
+

+

Sorry!

+

We are sold out of tickets!

+
+ +
+ +
\ No newline at end of file