parent
							
								
									bfeb4f5eef
								
							
						
					
					
						commit
						9a5182816f
					
				|  | @ -15,18 +15,28 @@ | |||
| 		die(); | ||||
| 	} | ||||
| 
 | ||||
| 	if(!isset($_REQUEST['code'])) | ||||
| 		die("MISSING INVITE CODE!"); | ||||
| 	function displayError(string $message) { | ||||
| 		$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'])) { | ||||
| 		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->execute([$_REQUEST['code']]); | ||||
| 
 | ||||
| 	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') {		 | ||||
|  | @ -95,8 +105,7 @@ | |||
| 	$statementInviteDeleter = $RUNTIME['PDO']->prepare('DELETE FROM InviteCodes WHERE InviteCode = :code');  | ||||
| 	$statementInviteDeleter->execute(['code' => $_REQUEST['code']]); | ||||
| 	if($statementInviteDeleter->rowCount() == 0) { | ||||
| 		header('Location: index.php'); | ||||
| 		die(); | ||||
| 		displayError("Der angegebene Einladungscode ist nicht mehr gültig."); | ||||
| 	} | ||||
| 
 | ||||
| 	try { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Anonymous Contributor
						Anonymous Contributor