Example #1
0
         include 'presentation/updateForm.php';
     }
 } elseif (isset($_GET["action"]) && $_GET["action"] == "wijzig" && $_GET["wat"] == "email") {
     if (empty($_POST["email"]) || empty($_POST["email2"])) {
         $messageEmail = "Niks ingevuld?";
     } elseif (!filter_var($_POST["email"], FILTER_VALIDATE_EMAIL) && !filter_var($_POST["email2"], FILTER_VALIDATE_EMAIL)) {
         $messageEmail = "De opgegeven emailadressen zijn niet geldig";
     } elseif ($_POST["email"] === $_POST["email2"]) {
         if ($gebruikerS->checkGebruikerE($_POST["email"], $_SESSION["id"])) {
             $messageEmail = "Dit emailadres komt al voor";
         } elseif ($_POST["email"] === $gebruikerS->getEmailGebruiker($_SESSION["id"])) {
             $messageEmail = "Te wijzigen email is hetzelfde als bestaand email";
         } else {
             $email = $_POST["email"];
             setcookie("user", $_POST["email"], time() + 86400 * 30, "/");
             $gebruikerS->updateGebruikerEmail($gebruiker, $email);
             $messageEmail = "Uw email is gewijzigd";
         }
     } elseif ($_POST["email"] != $_POST["email2"]) {
         $messageEmail = "Uw emailadressen komen niet overeen";
     }
     include 'presentation/updateForm.php';
 } elseif (isset($_GET["action"]) && $_GET["action"] == "wijzig" && $_GET["wat"] == "paswoord") {
     if (empty($_POST["paswoord"]) || empty($_POST["paswoord2"])) {
         $messagePaswoord = "Niks ingevuld?";
     } else {
         try {
             $gebruikerS->updateGebruikerPaswoord($gebruiker, $_POST["paswoord"], $_POST["paswoord2"]);
             $messagePaswoord = "Uw paswoord is gewijzigd";
         } catch (Exception $ex) {
             $messagePaswoord = $ex->getMessage();