<?php session_start(); require_once 'business/gebruikerSERVICE.php'; require 'PHPMailerAutoload.php'; unset($_SESSION["message"]); if (isset($_SESSION["ingelogd"])) { $gebruikerServ = new GebruikerService(); $emailContact = $gebruikerServ->getEmailGebruiker($_SESSION["id"]); } if (isset($_GET["contact"]) && ($_GET["contact"] = "zend")) { //kontrole allebei de velden ingevuld? if (isset($_POST["email"], $_POST["textarea"]) && !empty($_POST["email"]) && !empty($_POST["textarea"])) { if (filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) { $mail = new PHPMailer(); $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.mailgun.org'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = '******'; // SMTP username $mail->Password = '******'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable encryption, only 'tls' is accepted $mail->From = '*****@*****.**'; $mail->FromName = 'Nick'; $mail->addAddress('*****@*****.**'); // Add a recipient
$messageUwGegevens = "U heeft niks gewijzigd aan de gegevens"; include 'presentation/updateForm.php'; } } else { $messageUwGegevens = "Alle gegevens zijn verplicht"; 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 {