parent
bfeb4f5eef
commit
9a5182816f
|
@ -15,18 +15,28 @@
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($_REQUEST['code']))
|
function displayError(string $message) {
|
||||||
die("MISSING INVITE CODE!");
|
$HTML = new HTML();
|
||||||
|
$HTML->importHTML("error.html");
|
||||||
|
$HTML->ReplaceLayoutInhalt("%%MESSAGE%%", $message);
|
||||||
|
$HTML->build();
|
||||||
|
echo $HTML->ausgabe();
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($_REQUEST['code'])) {
|
||||||
|
displayError("Du benötigst einen Einladungscode, um dich bei 4Creative zu registrieren.");
|
||||||
|
}
|
||||||
|
|
||||||
if(strlen($_REQUEST['code']) != 32 || !preg_match('/^[a-f0-9]+$/', $_REQUEST['code'])) {
|
if(strlen($_REQUEST['code']) != 32 || !preg_match('/^[a-f0-9]+$/', $_REQUEST['code'])) {
|
||||||
die("INVALID INVITE CODE!");
|
displayError("Der angegebene Einladungscode ist nicht gültig. Nutze genau den Link, der dir zugeschickt wurde.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$statementInviteCode = $RUNTIME['PDO']->prepare("SELECT 1 FROM InviteCodes WHERE InviteCode = ? LIMIT 1");
|
$statementInviteCode = $RUNTIME['PDO']->prepare("SELECT 1 FROM InviteCodes WHERE InviteCode = ? LIMIT 1");
|
||||||
$statementInviteCode->execute([$_REQUEST['code']]);
|
$statementInviteCode->execute([$_REQUEST['code']]);
|
||||||
|
|
||||||
if($statementInviteCode->rowCount() == 0) {
|
if($statementInviteCode->rowCount() == 0) {
|
||||||
die("INVALID INVITE CODE!");
|
displayError("Der angegebene Einladungscode ist nicht gültig. Nutze genau den Link, der dir zugeschickt wurde.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
|
@ -95,8 +105,7 @@
|
||||||
$statementInviteDeleter = $RUNTIME['PDO']->prepare('DELETE FROM InviteCodes WHERE InviteCode = :code');
|
$statementInviteDeleter = $RUNTIME['PDO']->prepare('DELETE FROM InviteCodes WHERE InviteCode = :code');
|
||||||
$statementInviteDeleter->execute(['code' => $_REQUEST['code']]);
|
$statementInviteDeleter->execute(['code' => $_REQUEST['code']]);
|
||||||
if($statementInviteDeleter->rowCount() == 0) {
|
if($statementInviteDeleter->rowCount() == 0) {
|
||||||
header('Location: index.php');
|
displayError("Der angegebene Einladungscode ist nicht mehr gültig.");
|
||||||
die();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue