Move all the stuff to the top so it can be run always

Signed-off-by: Skylar "The Cobra" Widulski <cobra@vern.cc>
This commit is contained in:
Skylar "The Cobra" Widulski 2023-08-26 04:13:29 -04:00
parent 321b935558
commit a8250004a5
Signed by: cobra
GPG Key ID: 4FD8F812083FF6F9
1 changed files with 41 additions and 40 deletions

View File

@ -39,24 +39,6 @@
else $err = "Invalid E-mail";
else $err = "E-mail is required";
if (empty($_GET['action']) || ($_GET['action'] != "sub" && $_GET['action'] != "unsub") || !empty($err) && empty($_GET['code'])) {
?>
<div class=h><h1 id=list>Mailing List</h1> <a aria-hidden=true href=#list>#list</a></div>
<form method="get" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]) ?>">
<p>E-mail <span class="red">* <?php echo $err; ?></span>
<input type="text" name="email"></p>
<select id="action" name="action">
<option value="sub">Subscribe</option>
<option value="unsub">Unsubscribe</option>
</select><br>
<br>
<span><input type="submit" value="Submit" style="width:100px;height:40px;font-size:20px"></span>
</form><br>
<?php
} else {
$filename = "/tmp/list-code-" . $email;
if (!empty($_GET['code'])) {
@ -97,6 +79,25 @@
mail($email, $subject, $message, $headers);
}
if (empty($_GET['action']) || ($_GET['action'] != "sub" && $_GET['action'] != "unsub") || !empty($err) && empty($_GET['code'])) {
?>
<div class=h><h1 id=list>Mailing List</h1> <a aria-hidden=true href=#list>#list</a></div>
<form method="get" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]) ?>">
<p>E-mail <span class="red">* <?php echo $err; ?></span>
<input type="text" name="email"></p>
<select id="action" name="action">
<option value="sub">Subscribe</option>
<option value="unsub">Unsubscribe</option>
</select><br>
<br>
<span><input type="submit" value="Submit" style="width:100px;height:40px;font-size:20px"></span>
</form><br>
<?php
} else {
?>
<div class=h><h1 id=confirm>Confirm Action</h1> <a aria-hidden=true href=#confirm>#confirm</a></div>
<p>A confirmation code was sent to <?php echo htmlspecialchars($email); ?></p>