add invite generator
parent
25107044ce
commit
91a5e69de5
|
@ -0,0 +1,23 @@
|
|||
<div style="width: 400px; margin: auto; left: 50%;">
|
||||
Hier kannst du einen Invite Link erstellen.<br>
|
||||
Jeder der solch einen Link bekommt, kann sich im Grid Regestrieren.
|
||||
Der Link ist einzigartig und funktioniert nur einmalig.<br>
|
||||
Nach dem aufrufen des Links muss ein Name, Passwort und Standart Avatar ausgewählt werden.
|
||||
</div>
|
||||
|
||||
<div style="width: 400px; margin: auto; left: 50%;">
|
||||
<form action="index.php?page=invite" method="post">
|
||||
<div class="row" style="margin-top: 15px;">
|
||||
<div class="col">
|
||||
<label for="linkOutput">InviteLink:</label>
|
||||
<input type="text" class="form-control" id="linkOutput" name="formLink" placeholder="%%link%%">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-top: 15px;">
|
||||
<div class="col">
|
||||
<button type="submit" name="generateLink" class="btn btn-primary btn-lg">Link Generieren</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
|
@ -0,0 +1,27 @@
|
|||
<?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();
|
||||
?>
|
Loading…
Reference in New Issue