Ejemplo n.º 1
0
<?php

//use WijnshopTest\Exceptions\;
session_start();
use WijnshopTest\Business\KlantService;
require_once "Bootstrap.php";
require_once "Libraries/Twig/AutoLoader.php";
if (isset($_GET["action"]) && $_GET["action"] == "aanmelden") {
    $klantservice = new KlantService();
    $toegelaten = $klantservice->controlKlant($_POST["txtEmail"], $_POST["txtWachtwoord"]);
    if (!$toegelaten) {
        $_SESSION["aangemeld"] = true;
        header("location: index.php");
        exit(0);
    } else {
        header("location: login.php?error=fouteInlog");
        exit(0);
    }
} else {
    if (isset($_GET["error"])) {
        $error = $_GET["error"];
        //print_r($error);
    }
}
$view = $twig->render("Login.twig", array());
print $view;
//"error" => $error
Ejemplo n.º 2
0
//use \Exceptions\;
use WijnshopTest\Business\KlantService;
require_once "Bootstrap.php";
require_once "Libraries/Twig/AutoLoader.php";
session_start();
$naam = $_POST["naam"];
$voornaam = $_POST["voornaam"];
$straat = $_POST["straat"];
$nr = $_POST["nr"];
$postcode = $_POST["postcode"];
$gemeente = $_POST["gemeente"];
$wachtwoord = $_POST["wachtwoord"];
$email = $_POST["email"];
$error = "";
if (isset($_GET["action"]) && $_GET["action"] == "registreer") {
    $klantService = new KlantService();
    $wachtwoord = $klantService->checkWachtwoord($wachtwoord);
    $leeginput = $klantService->checkLeegInput($naam, $voornaam, $straat, $nr, $postcode, $gemeente, $wachtwoord, $email);
    $checkemail = $klantService->checkEmail($email);
    if (!$wachtwoord) {
        header("location: registreren.php?error=wachtwoord");
        exit(0);
    }
    if (!$leeginput) {
        header("location: registreren.php?error=leegInput");
        exit(0);
    }
    if ($checkemail) {
        header("location: registreren.php?error=foutEmail");
        exit(0);
    } else {
Ejemplo n.º 3
0
//WijnProject/login.php
use WijnshopTest\Business\KlantService;
use WijnshopTest\Exceptions\FouteLoginException;
require_once "Bootstrap.php";
require_once "Libraries/Twig/AutoLoader.php";
//error_reporting(0); // Of php.ini aanpassen : error_reporting
session_start();
$error = "";
$email = "";
$wachtwoord = "";
if (isset($_GET["action"])) {
    $email = trim(htmlspecialchars($_POST["txtEmail"], ENT_QUOTES));
    $wachtwoord = trim(htmlspecialchars($_POST["txtWachtwoord"], ENT_QUOTES));
    if ($_GET["action"] == "aanmelden") {
        $klantService = new KlantService();
        try {
            $klantService->controlKlant($email, $wachtwoord);
            $id = $klantService->getKlantId($email);
            $_SESSION["aangemeld"] = true;
            $_SESSION["id"] = $id;
            header("location: index.php");
            exit(0);
        } catch (FouteLoginException $fle) {
            header("location: login.php?error=fouteInlog");
            exit(0);
        }
    }
} else {
    if (isset($_GET["error"])) {
        $error = $_GET["error"];
Ejemplo n.º 4
0
<?php

//use \Exceptions\;
//use \Business\Service;
use WijnshopTest\Business\WijnService;
use WijnshopTest\Business\KlantService;
//use WijnshopTest\Data\KlantDAO;
require_once "Bootstrap.php";
require_once "Libraries/Twig/AutoLoader.php";
//$klantDAO = new KlantDAO();
//$klanten = $klantDAO->getAll();
//print_r ($klanten);
session_start();
if (isset($_GET["action"]) && $_GET["action"] == "test") {
    $wijnService = new WijnService();
    $wijn = $wijnService->newWijn($_POST["naam"], $_POST["jaartal"], $_POST["land"], $_POST["cat"], $_POST["image"], $_POST["artcode"], $_POST["prijs"]);
    exit(0);
    if ($wijn) {
        header("location: test.php");
    } else {
        print "ok";
        header("location: test.php");
    }
}
$klantService = new KlantService();
$email = "*****@*****.**";
$klant = $klantService->getKlantByEmail($email);
print_r($klant);
$view = $twig->render("Test.twig", array());
print $view;
Ejemplo n.º 5
0
require_once "Bootstrap.php";
require_once "Libraries/Twig/AutoLoader.php";
//error_reporting(0); // Of php.ini aanpassen : error_reporting
session_start();
$error = "";
if (isset($_GET["action"])) {
    $naam = trim(htmlspecialchars($_POST["naam"], ENT_QUOTES));
    $voornaam = trim(htmlspecialchars($_POST["voornaam"], ENT_QUOTES));
    $straat = trim(htmlspecialchars($_POST["straat"], ENT_QUOTES));
    $nr = trim(htmlspecialchars($_POST["nr"], ENT_QUOTES));
    $postcode = trim(htmlspecialchars($_POST["postcode"], ENT_QUOTES));
    $gemeente = trim(htmlspecialchars($_POST["gemeente"], ENT_QUOTES));
    $wachtwoord = trim(htmlspecialchars($_POST["wachtwoord"], ENT_QUOTES));
    $email = trim(htmlspecialchars($_POST["email"], ENT_QUOTES));
    if ($_GET["action"] == "registreer") {
        $klantService = new KlantService();
        try {
            $klantService->newKlant($naam, $voornaam, $straat, $nr, $postcode, $gemeente, $wachtwoord, $email);
            header("location: login.php");
            exit(0);
        } catch (GeenLegeInputException $se) {
            header("location: registreren.php?error=leegInput");
            exit(0);
        } catch (InvalidPasswordException $e) {
            header("location: registreren.php?error=wachtwoord");
            exit(0);
        } catch (EmailBestaatException $ex) {
            header("location: registreren.php?error=emailBestaat");
            exit(0);
        } catch (NoValidEmailException $ex) {
            header("location: registreren.php?error=noValidEmail");