129 lines
4.6 KiB
PHP
129 lines
4.6 KiB
PHP
<?php session_start();
|
|
|
|
$Benutzername = $_POST["Benutzername"];
|
|
|
|
|
|
|
|
$Email = strip_tags(htmlentities($_POST["Email"]));
|
|
$Passwort = strip_tags(htmlentities($_POST["Passwort"]));
|
|
$Passwort2 = strip_tags(htmlentities($_POST["Passwort2"]));
|
|
|
|
$Passwort = hash('sha512',$Passwort);
|
|
|
|
$Passwort2 = hash('sha512',$Passwort2);
|
|
|
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
$randstring = '';
|
|
for ($i = 0; $i < 10; $i++) {
|
|
$randstring = $characters[rand(0, strlen($characters))];
|
|
}
|
|
$randstring = hash('crc32',$randstring);
|
|
$RealCode = $randstring;
|
|
$_SESSION["RealCode"] = $randstring;
|
|
|
|
$_SESSION["Benutzername"] = $Benutzername;
|
|
$_SESSION["Email"] = $Email;
|
|
$_SESSION["Passwort"] = $Passwort;
|
|
|
|
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>VokabelBox</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="../../files/style.css" />
|
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<p onclick="window.location.href='../../index'"></p>
|
|
<div class="more-menu">
|
|
<button class="fas fa-ellipsis-v"></button>
|
|
<div class="more-menu-content">
|
|
<div onclick="window.location.href='../../index'" title="VokabelBox"><i class="fas fa-home"></i>VokabelBox</div>
|
|
<div onclick="window.location.href='../../myaccount'" title="Mein Account"><i class="far fa-user-circle"></i>Mein Account</div>
|
|
<div onclick="window.location.href='../../marks'" title="Meine Noten"><i class="fas fa-table"></i>Meine Noten</div>
|
|
<div onclick="window.location.href='../../search'" title="Meine VokabelBox durchsuchen"><i class="fas fa-search"></i>Suchen</div>
|
|
<div onclick="window.location.href='../../help'" title="Hilfecenter öffnen"><i class="fas fa-question-circle"></i>Hilfe</div>
|
|
<div onclick="window.location.href='../../actions/logout'" title="Von VokabelBox abmelden"><i class="fas fa-sign-out-alt"></i>Ausloggen</div>
|
|
<br>
|
|
<div class="selected" title="Du erstellst Dir gerade ein Benutzerkonto"><i class="fas fa-user"></i>Account erstellen</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<main>
|
|
<div class="middle">
|
|
<?php
|
|
|
|
require "../../files/ezine_db.inc.php";
|
|
|
|
if(empty($Benutzername) || empty($Email) || empty($Passwort) || empty($Passwort2)) {
|
|
$_SESSION["errorCode"] = 'generalError';
|
|
print("<meta http-equiv='refresh' content='0; URL=../../register'>");
|
|
}
|
|
else{
|
|
if($Passwort != $Passwort2) {
|
|
$_SESSION["errorCode"] = 'keineUebereinstimmung';
|
|
print("<meta http-equiv='refresh' content='0; URL=../../register'>");
|
|
}
|
|
else {
|
|
|
|
$sql = "SELECT * FROM `VokabelBoxUsers` WHERE `Benutzername` = '$Benutzername'";
|
|
$result_articles = $conn->query($sql);
|
|
|
|
if(mysqli_num_rows($result_articles))
|
|
{
|
|
$_SESSION["errorCode"] = 'usernameRegistered';
|
|
print("<meta http-equiv='refresh' content='0; URL=../../register'>");
|
|
}
|
|
else {
|
|
$sql = "SELECT * FROM `VokabelBoxUsers` WHERE `Email` = '$Email'";
|
|
$result_articles = $conn->query($sql);
|
|
|
|
if(mysqli_num_rows($result_articles))
|
|
{
|
|
$_SESSION["errorCode"] = 'emailRegistered';
|
|
print("<meta http-equiv='refresh' content='0; URL=../../register'>");
|
|
}
|
|
else {
|
|
|
|
if(strpos($Benutzername,'\'')!==false || strpos($Benutzername,'\\')!==false) {
|
|
$_SESSION["errorCode"] = 'unallowedCharacters';
|
|
print("<meta http-equiv='refresh' content='0; URL=../../register'>");
|
|
}
|
|
else {
|
|
|
|
|
|
$betreff = "Accountverifizierung fuer VokabelBox";
|
|
$from = "VokabelBox";
|
|
$text = "Dein Code: " . $RealCode;
|
|
mail($Email, $betreff, $text, $from);
|
|
|
|
print(
|
|
" <form action='activate-account' method='post'>
|
|
<p>Es wurde ein Code an <b>$Email </b>geschickt.</p>
|
|
<input maxlength='8' type='text' name='Code' required placeholder='Dein Code'>
|
|
<input type='submit' value='Überprüfen' class='classic-button classic-button-grey'>
|
|
</form>
|
|
");
|
|
|
|
$_SESSION["Benutzername"] = $Benutzername;
|
|
$_SESSION["Passwort"] = $Passwort;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
</div>
|
|
</middle>
|
|
</body>
|
|
</html>
|