Improve not expired message, close #19

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

@ -28,6 +28,7 @@ if (empty($IN_SITE)) {
<?php
$msg = "";
$alert = "danger";
if (!empty($_GET['msg'])) {
switch ($_GET['msg']) {
case "sessionexpired":
@ -40,17 +41,20 @@ if (empty($IN_SITE)) {
$msg = "That email address doesn't look right. Please try again.";
break;
case "tooearly":
if (!empty($_GET['exp']) && is_numeric($_GET['exp'])) {
$msg = "This membership isn't expiring until " . date("F Y", $_GET['exp'] * 1) . " and cannot be renewed yet.";
$alert = "info";
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 {
$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;
}
}
if ($msg != "") {
?>
<div class="alert alert-danger">
<div class="alert alert-<?php echo $alert; ?>">
<?php echo $msg; ?>
</div>
<?php

@ -25,7 +25,7 @@ if (!empty($_POST['email'])) {
$expires = (new Family())->load($familyid)->getExpires();
if ($expires > strtotime("+6 months")) {
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);

Loading…
Cancel
Save