|
|
@ -1,10 +1,5 @@
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
require 'JoueurGateway.php';
|
|
|
|
|
|
|
|
require '../Config/Validation.php';
|
|
|
|
|
|
|
|
require './JoueurNotFoundException.php';
|
|
|
|
|
|
|
|
require './InvalidMdpException.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Controller
|
|
|
|
class Controller
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private Connection $con;
|
|
|
|
private Connection $con;
|
|
|
@ -20,8 +15,8 @@ class Controller
|
|
|
|
$action=$_REQUEST['action'];
|
|
|
|
$action=$_REQUEST['action'];
|
|
|
|
switch($action) {
|
|
|
|
switch($action) {
|
|
|
|
case NULL:
|
|
|
|
case NULL:
|
|
|
|
//require ('../View/src/pages/Main.html');
|
|
|
|
require ('./View/src/pages/Main.php');
|
|
|
|
header('Location: http://londres.uca.local/~nogarnier1/Scripted/WEB/View/src/pages/Main.html');
|
|
|
|
//header('Location: http://londres.uca.local/~nogarnier1/Scripted/WEB/View/src/pages/Main.html');
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "signUp":
|
|
|
|
case "signUp":
|
|
|
|
$this->signUp();
|
|
|
|
$this->signUp();
|
|
|
@ -29,6 +24,18 @@ class Controller
|
|
|
|
case "login":
|
|
|
|
case "login":
|
|
|
|
$this->login();
|
|
|
|
$this->login();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "goToPresentation":
|
|
|
|
|
|
|
|
$this->goToPresentation();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "goToHome":
|
|
|
|
|
|
|
|
$this->goToHome();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "goToLogin":
|
|
|
|
|
|
|
|
$this->goToLogin();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "goToSignUp":
|
|
|
|
|
|
|
|
$this->goToSignUp();
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (PDOException $e)
|
|
|
|
} catch (PDOException $e)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -46,8 +53,8 @@ class Controller
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$joueur = new Joueur($_REQUEST['email'], $_REQUEST['username'], $_REQUEST['password']);
|
|
|
|
$joueur = new Joueur($_REQUEST['email'], $_REQUEST['username'], $_REQUEST['password']);
|
|
|
|
$gateway->insert($joueur);
|
|
|
|
$gateway->insert($joueur);
|
|
|
|
//$gateway->showAll();
|
|
|
|
$_SESSION['connected'] = 'true';
|
|
|
|
header('Location: http://londres.uca.local/~nogarnier1/Scripted/WEB/View/src/pages/Main.html');
|
|
|
|
require ('./View/src/pages/Main.php');
|
|
|
|
}catch (Exception $e){
|
|
|
|
}catch (Exception $e){
|
|
|
|
require($rep.$vues['erreurSignUp']);
|
|
|
|
require($rep.$vues['erreurSignUp']);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -64,11 +71,48 @@ class Controller
|
|
|
|
if ($mdp != $_REQUEST['password']){
|
|
|
|
if ($mdp != $_REQUEST['password']){
|
|
|
|
throw new InvalidMdpException("Mot de passe invalide");
|
|
|
|
throw new InvalidMdpException("Mot de passe invalide");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
header('Location: http://londres.uca.local/~nogarnier1/Scripted/WEB/View/src/pages/Main.html');
|
|
|
|
$_SESSION['connected'] = 'true';
|
|
|
|
|
|
|
|
require ('./View/src/pages/Main.php');
|
|
|
|
}catch (JoueurNotFoundException $e){
|
|
|
|
}catch (JoueurNotFoundException $e){
|
|
|
|
require($rep.$vues['erreurLoginEmail']);
|
|
|
|
require($rep.$vues['erreurLoginEmail']);
|
|
|
|
}catch (InvalidMdpException $m) {
|
|
|
|
}catch (InvalidMdpException $m) {
|
|
|
|
require($rep . $vues['erreurLoginMdp']);
|
|
|
|
require($rep . $vues['erreurLoginMdp']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function goToPresentation() {
|
|
|
|
|
|
|
|
global $rep, $vues;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
require ('./View/src/pages/Presentation.html');
|
|
|
|
|
|
|
|
}catch (Exception $e){
|
|
|
|
|
|
|
|
require($rep.$vues['erreur404']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function goToHome() {
|
|
|
|
|
|
|
|
global $rep, $vues;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
require ('./View/src/pages/Main.php');
|
|
|
|
|
|
|
|
}catch (Exception $e){
|
|
|
|
|
|
|
|
require($rep.$vues['erreur404']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function goToLogin() {
|
|
|
|
|
|
|
|
global $rep, $vues;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
require ('./View/src/pages/LogSign/Login.php');
|
|
|
|
|
|
|
|
}catch (Exception $e){
|
|
|
|
|
|
|
|
require($rep.$vues['erreur404']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function goToSignUp() {
|
|
|
|
|
|
|
|
global $rep, $vues;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
require ('./View/src/pages/LogSign/SignUp.php');
|
|
|
|
|
|
|
|
}catch (Exception $e){
|
|
|
|
|
|
|
|
require($rep.$vues['erreur404']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|