add things from 27-03-26
This commit is contained in:
@@ -27,36 +27,36 @@ if(!empty($_REQUEST)) { // Button wurde gedrückt?
|
||||
$email = $_REQUEST['email'];
|
||||
$pw = $_REQUEST['pw'];
|
||||
|
||||
if(isStrongPassword($pw)){ // hier kann man die gegeben Funktion nutzen oder "checkPAsswordStrength" (aus functions.php)
|
||||
if(checkPasswordStrength($pw) AND isValidEmail($email)){
|
||||
$pw = password_hash($pw, PASSWORD_DEFAULT);
|
||||
} else {
|
||||
$errors .= "Passwort zu schwach!<br>";
|
||||
}
|
||||
|
||||
$query = "INSERT INTO user VALUES (NULL, :email, :pw)";
|
||||
$stmt = $dbh->prepare($query);
|
||||
$query = "INSERT INTO user VALUES (NULL, :email, :pw)";
|
||||
$stmt = $dbh->prepare($query);
|
||||
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':pw', $pw);
|
||||
$stmt->bindParam(':email', $email);
|
||||
$stmt->bindParam(':pw', $pw);
|
||||
|
||||
try {
|
||||
$stmt->execute();
|
||||
} catch(PDOException $e){
|
||||
$errMsg = $e->getMessage();
|
||||
$errCode = $e->getCode();
|
||||
try {
|
||||
$stmt->execute();
|
||||
$errors = "Alles malocht! :)";
|
||||
} catch(PDOException $e){
|
||||
$errMsg = $e->getMessage();
|
||||
$errCode = $e->getCode();
|
||||
|
||||
echo $e;
|
||||
echo $e;
|
||||
|
||||
switch($errCode) {
|
||||
case "23000": $custErrMsg = "<p>Email-Adress already exists!</p>"; break;
|
||||
default: $custErrMsg = "<p>Oooops, something went wrong!</p>";
|
||||
switch($errCode) {
|
||||
case "23000": $custErrMsg = "<p>Email-Adress already exists!</p>"; break;
|
||||
default: $custErrMsg = "<p>Oooops, something went wrong!</p>";
|
||||
}
|
||||
echo $custErrMsg;
|
||||
}
|
||||
echo $custErrMsg;
|
||||
} else {
|
||||
$errors .= "Passwort zu schwach oder Email ist ungültig !<br>";
|
||||
}
|
||||
} else {
|
||||
$errors .= "Beide Felder müssen ausgefüllt werden<br>";
|
||||
} // Ende Felder müssen ausgefüllt werden.
|
||||
|
||||
}
|
||||
|
||||
if ($errors != "") echo $errors;
|
||||
Reference in New Issue
Block a user