Add TOS agree checkbox

master
Skylar Ittner 7 years ago
parent 2cda2eb362
commit 5deb6808fd

@ -21,6 +21,8 @@
?> ?>
<span style="color: blue; font-weight: 400;">| via CJDNS</span> <span style="color: blue; font-weight: 400;">| via CJDNS</span>
<?php <?php
} else {
$clearnet = true;
} }
?></span></a> ?></span></a>
</div> </div>

@ -1,6 +1,5 @@
<?php <?php
require_once __DIR__ . "/settings.php"; require_once __DIR__ . "/settings.php";
require_once __DIR__ . "/database.php";
$plan = $_GET['plan']; $plan = $_GET['plan'];
if (!isset(PLANS[$plan])) { if (!isset(PLANS[$plan])) {
header("Location: /#pricing"); header("Location: /#pricing");
@ -27,18 +26,38 @@ include __DIR__ . '/inc/piwik.php';
<div class="content"> <div class="content">
<p>Purchase a month of service. If you are a new user, enter a username, password, and email to register with. If you are an existing user, enter your login username and password, check the renewal box, and enter a valid email address.</p> <p>Purchase a month of service. If you are a new user, enter a username, password, and email to register with. If you are an existing user, enter your login username and password, check the renewal box, and enter a valid email address.</p>
<?php <?php
if ($_GET["err"] == "renewinvaliduser") { $err = "";
echo "<div><b>You have selected the renew option, but the username you gave does not exist.</b></div>"; switch ($_GET['err']) {
} else if ($_GET['err'] == "usernameinvalid") { case "renewinvaliduser":
echo "<div><b>That username is not available. Please choose another.</b></div>"; $err = "You have selected the renew option, but the username you gave does not exist.";
} else if ($_GET['err'] == "renewpasswrong") { break;
echo "<div><b>The password is incorrect.</b></div>"; case "usernameinvalid":
} else if ($_GET['err'] == "bademail") { $err = "That username is not available. Please choose another.";
echo "<div><b>The email address is not in a valid format. Try again.</b></div>"; break;
} else if ($_GET['err'] == "shortpassword") { case "renewpasswrong":
echo "<div><b>Your password is too short. It needs to be at least 8 characters long.</b></div>"; $err = "The password is incorrect.";
} else if ($_GET['err'] == "commonpassword") { break;
echo "<div><b>Your chosen password is in a <a href=\"https://github.com/danielmiessler/SecLists/tree/master/Passwords\">public list</a> of 1,000,000 common passwords, and is therefore insecure. Choose a better one.</b></div>"; case "bademail":
$err = "The email address is not in a valid format. Try again.";
break;
case "shortpassword":
$err = "Your password is too short. It needs to be at least 8 characters long.";
break;
case "commonpassword":
$err = "Your chosen password is in a <a href=\"https://github.com/danielmiessler/SecLists/tree/master/Passwords\">public list</a> of 1,000,000 common passwords, and is therefore insecure. Choose a better one.";
break;
case "acceptterms":
$err = "You need to accept the terms of service.";
break;
case "":
$err = "";
break;
default:
$err = "An unknown error occurred. Try again, and if the issue persists, <a href=\"https://support.netsyms.com/index.php?a=add&category=9\">open a support ticket</a>.";
break;
}
if ($err !== "") {
echo "<div style=\"margin-bottom: 10px;\"><b style=\"color: #a93226;\">$err</b></div>";
} }
?> ?>
<form action="purchase2.php" method="POST"> <form action="purchase2.php" method="POST">
@ -54,13 +73,14 @@ include __DIR__ . '/inc/piwik.php';
<input type="checkbox" name="renewing" id="renewing" value="1" /> <label for="renewing">This is a renewal</label> <input type="checkbox" name="renewing" id="renewing" value="1" /> <label for="renewing">This is a renewal</label>
<br /> <br />
<input type="hidden" name="plan" value="<?php echo $plan; ?>" /> <input type="hidden" name="plan" value="<?php echo $plan; ?>" />
<p>By pressing the Next button, you agree to <a href="terms.php" target="_BLANK">these terms</a>. <br />
<br /> <input type="checkbox" name="agree_tos" id="agree_tos" value="1" /> <label for="agree_tos">I agree to the <a href="terms.php" target="_BLANK">terms of service (click to read in new tab)</a></label>
<?php if ($plan != "free" && $clearnet == false) { ?> <br />
<?php if ($plan != "free" && $clearnet == false) { ?>
Note: The next page needs to load third-party clearnet code from Stripe to process your payment. If you don't want that, email dsm@netsyms.com and mention your preferred methods. Note: The next page needs to load third-party clearnet code from Stripe to process your payment. If you don't want that, email dsm@netsyms.com and mention your preferred methods.
<br /> <br />
<?php } ?> <?php } ?>
<button type="submit">Next</button> <button type="submit">Next</button>
</form> </form>
</div> </div>
</div> </div>

@ -19,6 +19,11 @@ if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
die("Invalid email address."); die("Invalid email address.");
} }
if ($_POST['agree_tos'] !== '1') {
header("Location: purchase.php?plan=" . $plan . "&err=acceptterms");
die("You need to accept the terms of service first.");
}
$renewing = (isset($_POST["renewing"]) && $_POST["renewing"] == "1"); $renewing = (isset($_POST["renewing"]) && $_POST["renewing"] == "1");
if ($renewing && !$userexists) { if ($renewing && !$userexists) {
header("Location: purchase.php?plan=" . $plan . "&err=renewinvaliduser"); header("Location: purchase.php?plan=" . $plan . "&err=renewinvaliduser");

Loading…
Cancel
Save