94 lines
3.5 KiB
PHP
94 lines
3.5 KiB
PHP
<?php
|
|
|
|
// META gibt an, mit welcher Kontoänderung fortgefahren werden soll
|
|
if($meta != 'change-email' && $meta != 'change-password' && $meta != 'delete-account') {
|
|
print("Auf dieser Seite ist ein Fehler aufgetreten!");
|
|
die();
|
|
}
|
|
|
|
// META wird für den nächsten Schritt gespeichert
|
|
$_SESSION["verify-identity"] = $meta;
|
|
|
|
// E-Mail wird aus der Datenbank geholt
|
|
$sql = "SELECT
|
|
*
|
|
FROM
|
|
`VokabelBox2Users`
|
|
WHERE
|
|
`userid` = '$userid'";
|
|
$result_articles = $conn->query($sql);
|
|
while ($articleDb = mysqli_fetch_object($result_articles))
|
|
{
|
|
$email = $articleDb->email;
|
|
}
|
|
|
|
// Neuer Code wird generiert
|
|
$code = '';
|
|
$string = "0123456789";
|
|
for ($i = 1; $i <= 4; $i++)
|
|
{
|
|
$zufallszahl = rand(0, 9);
|
|
$zufallszahl = substr($string, $zufallszahl, 1);
|
|
$code = $code . $zufallszahl;
|
|
}
|
|
|
|
// Die Session ist explizit auf VERIFY bezogen! Andernfalls kann die Session anderer Seiten missbraucht werden!
|
|
$_SESSION["verify-code"] = $code;
|
|
$_SESSION["verify-codeFails"] = 0;
|
|
|
|
// Email zur Verifizierung
|
|
$betreff = "Kontosicherheit Ihres VokSpace";
|
|
$from = "VokSpace";
|
|
$text = '
|
|
<html">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
<title>Bitte bestätigen Sie Ihr Konto</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
</head>
|
|
<body style="background-color: #3d434b;padding: 20px;">
|
|
<div style="margin-top: 50px;position:relative;overflow:hidden;background-color: #212529;border-radius: 30px;">
|
|
<div style="width: 50px;float:right;display:block;background-color: rgba(249,130,72,1);height:200px">
|
|
</div>
|
|
<div style="width: auto;float:left;display:block;padding:20px">
|
|
<h2 style="font-family: Arial;color:#fff;margin: 5px 0;font-size:40px">Ihr Code: ' . $code . '</h2>
|
|
<h5 style="font-family: Arial;color:#fff;margin: 5px 0;font-size:15px">Die Bestätigung Ihrer Identität ist erforderlich, um sicherheitsrelevante Informationen Ihrer Kontos zu ändern.<br>Wenn Ihnen diese Aktivität nicht bekannt vorkommt, ändern Sie bitte SOFORT Ihr Passwort, um Ihr Konto zu schützen.</h5>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>';
|
|
|
|
$header = "MIME-Version: 1.0\r\n";
|
|
$header .= "Content-type: text/html; charset=utf-8\r\n";
|
|
|
|
$header .= "From: VokSpace\r\n";
|
|
$header .= "Reply-To: tim@timvandenboom.de\r\n";
|
|
// $header .= "Cc: $cc\r\n"; // falls an CC gesendet werden soll
|
|
$header .= "X-Mailer: PHP ". phpversion();
|
|
|
|
mail($email, $betreff, $text, $header);
|
|
|
|
?>
|
|
|
|
<div class="fixed-title">
|
|
<h2>Identität bestätigen</h2>
|
|
</div>
|
|
<div class="center-wrapper">
|
|
<div class="center">
|
|
<h4>Aus Sicherheitsgründen ist die Bestätigung Ihrer Identität erforderlich. Geben Sie bitte den an Ihre E-Mail-Adresse versendeten Code ein und bestätigen Sie Ihr Kennwort.</h4>
|
|
<h4>Der Code wurde an <?php echo $email; ?> gesendet.</h4>
|
|
<div class="form">
|
|
<div class="input-wrapper">
|
|
<input type="number" name="Code" id="verify-code" oninput="checkIfFilled('verify-code')">
|
|
<span>Ihr Code</span>
|
|
</div>
|
|
<p>Sie haben insgesamt drei Versuche<p>
|
|
<div class="input-wrapper">
|
|
<input type="password" name="Passwort" id="verify-password" oninput="checkIfFilled('verify-password')">
|
|
<span>Ihr Passwort</span>
|
|
</div>
|
|
</div>
|
|
<button onclick="getContent('action:verify-identity')" class="default-button">Weiter</button>
|
|
</div>
|
|
</div>
|