Files
vokspace/temporary/pagecontent/action-change-email.php
2026-01-02 21:08:58 +01:00

75 lines
2.2 KiB
PHP

<?php
// Neue E-Mail wird geholts
$email = substr($_POST["email"], 0, 256);
// Testen, ob ausgefüllt
if(empty($email) || !filter_var($email, FILTER_VALIDATE_EMAIL) ) {
print("incompleteUserdata");
die();
}
// Schauen, ob E-Mail schon bekannt ist
$sql = "SELECT * FROM `VokabelBox2Users` WHERE `email` = '$email'";
$result_articles = mysql_query ($sql, $ezine_db);
if(mysql_num_rows($result_articles))
{
print("emailRegistered");
die();
}
// Neue E-Mail als Session hinterlegen
$_SESSION["email-change-email"] = $email;
// Neuen Code generieren
$code = '';
$string = "0123456789";
for ($i = 1; $i <= 4; $i++)
{
$zufallszahl = rand(0, 9);
$zufallszahl = substr($string, $zufallszahl, 1);
$code = $code . $zufallszahl;
}
// Neuer Code wird als Session gesetzt
$_SESSION["email-change-code"] = $code;
// Anzahl d. Fehlversuche wird zurückgesetzt
$_SESSION["email-change-codeFails"] = 0;
$betreff = "Neue E-Mail bestätigen";
$from = "VokSpace";
$text = '
<html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Bitte best&auml;tige deine neue E-Mail-Adresse</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>
</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);
print("true");
?>