has("families", ['email' => strtolower($_POST['email'])])) { header("Location: ./?page=renew&msg=noemail"); die("We don't have that email on file for any current families."); } $familyid = $database->get('families', 'familyid', ['email' => strtolower($_POST['email'])]); // Check expiration date $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 j, Y", $expires) . " and cannot be renewed yet."); } $code = mt_rand(100000, 999999); $_SESSION['code'] = $code; $_SESSION['maybefamily'] = $familyid; try { $verification = new Email(); $verification->addTo($SETTINGS["smtp"]["notification_to"]); $verification->setFrom($SETTINGS["smtp"]["fromaddress"], $SETTINGS["smtp"]["fromname"]); $verification->setSMTP($SETTINGS["smtp"]["host"], $SETTINGS["smtp"]["port"], $SETTINGS["smtp"]["auth"], $SETTINGS["smtp"]["user"], $SETTINGS["smtp"]["password"], $SETTINGS["smtp"]["secure"]); $verification->setSubject("HACHE email verification"); $verification->setBody("The verification code for renewing your HACHE membership is $code."); $verification->send(); } catch (Exception $e) { } } else if (!empty($_POST['code'])) { if (empty($_SESSION['code'])) { header("Location: ./?page=renew&msg=sessionexpired"); die("You took too long and were automatically logged out. Please try again."); } if (preg_replace("/[^0-9]/", "", $_POST['code']) == $_SESSION['code']) { $_SESSION['familyid'] = $_SESSION['maybefamily']; header("Location: ./?page=signup"); die("You are verified, go to ./?page=signup"); } $badcode = true; } else { header("Location: ./?page=renew&msg=bademail"); die("That email address doesn't look right. Please try again."); } ?>
HACHE: Helena Area Christian Home Educators

Renew Your Membership

Enter the code from the email we just sent you. If you didn't get it, check your spam or junk folder.

The code you entered is incorrect.