public function newUser($email) { $userService = new UserService(); $paswoord = $userService->genRandomPaswoord(); $paswoord = sha1($paswoord); $email = $userService->checkEmail($email); $userDAO = new UserDAO(); $user = $userDAO->createUser($email, $paswoord); $userService = new UserService(); }
require_once "Bootstrap.php"; ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php /* print_r ($userLijst); $char = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; $paswoord= substr(sha1(rand()),0,4); print $paswoord;*/ // $userService = new UserService(); //$newPaswoord = $userService->genRandomPaswoord(); //print $newPaswoord; $userService = new UserService(); $userEmail = $userService->newUser("email@email"); print $userEmail; // $newpas = $userService->genRandomPaswoord(); // print($newpas); $pas = $userService->checkEmail("emailemail"); print_r($pas); ?> </body> </html>
<?php //use BroodjesProject\Exceptions\; use BroodjesProject\Business\UserService; require_once "Bootstrap.php"; require_once "Libraries/Twig/AutoLoader.php"; session_start(); if (isset($_GET["action"]) && $_GET["action"] == "login") { $userservice = new UserService(); $toegelaten = $userservice->controlUser($_POST["txtEmail"], $_POST["txtPaswoord"]); if ($toegelaten) { $_SESSION["aangemeld"] = true; header("location: bestelbroodjesControll.php"); exit(0); } else { header("location: loginControll.php"); exit(0); } } $view = $twig->render("Login.twig", array()); print $view;
<?php //use BroodjesProject\Exceptions\; //use BroodjesProject\Business\Service; use BroodjesProject\Business\UserService; require_once "Bootstrap.php"; require_once "Libraries/Twig/AutoLoader.php"; session_start(); if (isset($_POST["action"]) && $_POST["action"] == "registreer") { $email = $_GET["textemail"]; $email = filter_var($email, FILTER_VALIDATE_EMAIL); //$email = htmlspecialchars($email); if ($email) { $userService = new UserService(); $userEmail = $userService->checkEmail($email); $userEmail = $userService->newUser(); header("location: bestelbroodjesControll.php"); exit(0); } else { header("location: registrerenContoll.php"); } } /*if (empty($_GET["textemail"])) { $emailErr = "Email is required"; } else { $email = $_GET["textemail"]; print($email); // check if e-mail address is well-formed if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "Invalid email format"; }