add check for tickets on sale

This commit is contained in:
Chris Smith
2019-03-09 21:43:22 -06:00
parent 26b44d653b
commit ae66a1ba6b
3 changed files with 19 additions and 0 deletions

View File

@@ -47,6 +47,7 @@ $router->get('/', function () {
header('Location: /sold-out');
}
checkIfTicketsAreOnSale();
include 'views/common/head.php';
include 'views/family.php';
include 'views/common/footer.php';
@@ -59,6 +60,7 @@ $router->get('/notify', function () {
});
$router->get('/step-1', function () {
checkIfTicketsAreOnSale();
include 'views/common/head.php';
include 'views/step1.php';
include 'views/common/footer.php';

View File

@@ -84,4 +84,15 @@ function shoppingCartTotal($price)
<span>Total</span>
<strong>' . '$' . number_format(($price / 100), 2) . '</strong>
</li>';
}
function checkIfTicketsAreOnSale() {
$todaysDate = new DateTime('now', new DateTimeZone('America/Chicago'));
$dateOnSale = new DateTime('3/15/2019 9:00am', new DateTimeZone('America/Chicago'));
$interval = $todaysDate->diff($dateOnSale);
if($interval->days >= 0 && $interval->invert === 0) {
header('Location: /notify?d='.$dateOnSale->format('c'));
}
}

View File

@@ -3,6 +3,12 @@
<div class="mb-12 text-center">
<br/><br/>
<h3>Sorry - tickets are not on sale to the public yet.</h3>
<?php
if (isset($_GET['d'])) {
$date = new DateTime($_GET['d']);
echo '<h5>Tickets go on sale ' . $date->format('F jS, Y \a\t h:ia') . '</h5>';
}
?>
<!-- Begin Mailchimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">
<style type="text/css">