<?php require_once "business/klantservice.class.php"; //ipv md5 :> bcrypt of sha256 or sha512 if (isset($_GET["action"]) and $_GET["action"] == "registreer") { try { klantservice::voegNieuweKlantToe($_POST["email"], md5($_POST["wachtwoord"]), $_POST["adres"], $_POST["naam"], $_POST["voornaam"], $_POST["postcode"], 0, $_POST["gemeente"]); print "Dank u voor uw registratie " . $_POST["voornaam"]; header("location:mastercontroller.php?p=reg"); exit(0); } catch (EmailBestaatException $tbe) { header("location:voegklanttoe.php?error=emailexists"); exit(0); } } else { $error = $_GET["error"]; include "presentation/registreer.php"; exit(0); }
<?php session_start(); require_once "business/klantservice.class.php"; if (isset($_GET["action"]) && $_GET["action"] == "login") { $klant = klantservice::controleerKlant($_POST["email"], md5($_POST["wachtwoord"])); if ($klant) { setcookie("login", $_POST["email"], time() + 60 * 60 * 24 * 30); $_SESSION["aangemeld"] = true; $_SESSION["klant"] = serialize($klant); $klantid = unserialize($_SESSION["klant"])->getId(); header("location:mastercontroller.php?klant=" . $klantid); exit(0); } else { header("location:login.php?error=foutelogin"); exit(0); } } else { $error = $_GET["error"]; include "mastercontroller.php"; exit(0); }