Improve not expired message, close #19

master
Skylar Ittner 6 years ago
parent 9d56af802d
commit 2ae1f97af1

@ -28,6 +28,7 @@ if (empty($IN_SITE)) {
<?php <?php
$msg = ""; $msg = "";
$alert = "danger";
if (!empty($_GET['msg'])) { if (!empty($_GET['msg'])) {
switch ($_GET['msg']) { switch ($_GET['msg']) {
case "sessionexpired": case "sessionexpired":
@ -40,17 +41,20 @@ if (empty($IN_SITE)) {
$msg = "That email address doesn't look right. Please try again."; $msg = "That email address doesn't look right. Please try again.";
break; break;
case "tooearly": case "tooearly":
if (!empty($_GET['exp']) && is_numeric($_GET['exp'])) { $alert = "info";
$msg = "This membership isn't expiring until " . date("F Y", $_GET['exp'] * 1) . " and cannot be renewed yet."; if (!empty($_GET['exp']) && is_numeric($_GET['exp']) && $_GET['exp'] * 1 > time()) {
$msg = "<i class=\"fas fa-calendar-check\"></i> This membership isn't expiring until " . date("F j, Y", $_GET['exp'] * 1) . " and cannot be renewed yet.";
} else { } else {
$msg = "This membership isn't close enough to expiration and cannot be renewed yet."; // Somebody is screwing with the URL
// for some reason
$msg = "<i class=\"fas fa-calendar-check\"></i> This membership isn't close enough to expiration and cannot be renewed yet.";
} }
break; break;
} }
} }
if ($msg != "") { if ($msg != "") {
?> ?>
<div class="alert alert-danger"> <div class="alert alert-<?php echo $alert; ?>">
<?php echo $msg; ?> <?php echo $msg; ?>
</div> </div>
<?php <?php

@ -25,7 +25,7 @@ if (!empty($_POST['email'])) {
$expires = (new Family())->load($familyid)->getExpires(); $expires = (new Family())->load($familyid)->getExpires();
if ($expires > strtotime("+6 months")) { if ($expires > strtotime("+6 months")) {
header("Location: ./?page=renew&msg=tooearly&exp=$expires"); header("Location: ./?page=renew&msg=tooearly&exp=$expires");
die("This membership isn't expiring until " . date("F Y", $expires) . " and cannot be renewed yet."); die("This membership isn't expiring until " . date("F j, Y", $expires) . " and cannot be renewed yet.");
} }
$code = mt_rand(100000, 999999); $code = mt_rand(100000, 999999);

Loading…
Cancel
Save