27 lines
1.0 KiB
PHP
27 lines
1.0 KiB
PHP
|
<?php
|
||
|
$HTML = new HTML();
|
||
|
$HTML->setHTMLTitle("Invite erstellen");
|
||
|
$HTML->importHTML("style/default/dashboard.html");
|
||
|
|
||
|
$HTML->ReplaceLayoutInhalt("%%USERNAME%%", $_SESSION['DISPLAYNAME']);
|
||
|
$HTML->importSeitenInhalt("pages/HTML/invite.html");
|
||
|
|
||
|
$statement = $RUNTIME['PDO']->prepare("CREATE TABLE IF NOT EXISTS `InviteCodes` (`InviteCode` VARCHAR(64) NOT NULL, PRIMARY KEY (`InviteCode`))");
|
||
|
$statement->execute();
|
||
|
|
||
|
if(isset($_REQUEST['generateLink']) || @$_REQUEST['generateLink'] != "")
|
||
|
{
|
||
|
$inviteID = md5(time().$_SESSION['UUID'].rand(11111, 9999999));
|
||
|
$link = "https://".$_SERVER['SERVER_NAME']."/index.php?page=register&code=".$inviteID;
|
||
|
|
||
|
$statement = $RUNTIME['PDO']->prepare('INSERT INTO `InviteCodes` (`InviteCode`) VALUES (:InviteCode)');
|
||
|
$statement->execute(['InviteCode' => $inviteID]);
|
||
|
|
||
|
$HTML->ReplaceSeitenInhalt("%%link%%", $link);
|
||
|
}
|
||
|
|
||
|
$HTML->ReplaceSeitenInhalt("%%link%%", ' ');
|
||
|
|
||
|
$HTML->build();
|
||
|
echo $HTML->ausgabe();
|
||
|
?>
|