$end = "[a-zA-Z\\d][\\w\\.-]*\\.[a-zA-Z]{2,4}"; $regExp = "/^" . $beginning . "@" . $end . "\$/"; if (preg_match($regExp, $email)) { if (emailExist($email)) { $info = "Diese Emailadresse existiert bereits."; } else { if (!empty($_POST['password']) && !empty($_POST['password2'])) { if ($_POST['password'] == $_POST['password2']) { if (strlen($_POST['password']) > 7) { $password = md5(trim(htmlentities($_POST['password'], ENT_QUOTES, "UTF-8"))); $email = $GLOBALS['DB']->escapeString($email); $password = $GLOBALS['DB']->escapeString($password); $query = "INSERT INTO user (email, password, passportID, name, firstName, street, city, zipCode, country,\r\n verifiedEmail, verifiedAccount, signUpTime) VALUES \r\n ('{$email}', '{$password}', 'notVerified', '', '', '', '', '', '', '1', '1', '" . time() . "') "; $result = $GLOBALS['DB']->query($query); //Speichern true und Emailverification true if ($result === true && makeVerificationCode($email) == true) { header("Location: signupsuccessful.php"); exit; } else { $info = "Etwas ist schief gelaufen"; } } else { $info = "Ihr Passwort muss mindestens 8 Zeichen lang sein."; } } else { $info = "Ihre Passwordwiederholung stimmt nicht überein"; } } else { $info = "Sie haben kein Passwort eingegben."; } }
if (isset($_POST['updateEmail'])) { if (!empty($_POST['email']) && !empty($_POST['email2'])) { if ($_POST['email'] == $_POST['email2']) { $email = trim(htmlentities($_POST['email'], ENT_QUOTES, "UTF-8")); $email = $GLOBALS['DB']->escapeString($email); if (emailExist($email)) { $info = "Diese Emailadresse existiert bereits."; } else { $userID = $_SESSION['userID']; $time = time(); $writeInUpdated = $GLOBALS['DB']->query("INSERT INTO updateddata (userID, oldData, time) VALUES ('{$userID}', '{$oldEmail}', '{$time}') "); if ($writeInUpdated == false) { die('Etwas ist schiefgelaufen, versuchen sie es bitte später erneut.'); } $write = $GLOBALS['DB']->query("UPDATE user SET email = '{$email}', verifiedEmail = '1' WHERE email = '{$oldEmail}' "); if ($write == true && makeVerificationCode($email)) { $delSecToken = $GLOBALS['DB']->query("DELETE FROM securitytoken WHERE userID = '" . $_SESSION['userID'] . "' \r\n AND securityToken = '" . $_SESSION['securityToken'] . "' "); if ($delSecToken == true) { $query = "DELETE FROM sessions WHERE userID = '" . $_SESSION['userID'] . "' AND sessionID = '" . $_SESSION['sessionID'] . "' "; $delete = $GLOBALS['DB']->query($query, true); session_destroy(); header("Location: login.php?i=1"); exit; } } } } else { $info = "Die Wiederholung stimmt nicht überein."; } } else { $info = "Sie haben nicht alle Felder ausgefüllt.";