Johan LACHENAL 2 years ago
commit 9505019968

@ -1,39 +0,0 @@
CREATE TABLE Admin(
email varchar(50) PRIMARY KEY,
pseudo varchar(50),
mdp varchar(50)
);
CREATE TABLE Enigme(
idEnigme char(5) PRIMARY KEY,
admin varchar(50) REFERENCES Admin(email),
enonce varchar(250) NOT NULL,
aide varchar(250),
rappel varchar(250),
solution varchar(250) NOT NULL,
test varchar(250) NOT NULL,
tempsDeResolution numeric CHECK (tempsDeResolution >0)
);
CREATE TABLE Joueur(
email varchar(50) PRIMARY KEY,
enigmeEnCours varchar(50) REFERENCES Enigme(idEnigme),
pseudo varchar(50),
mdp varchar(50)
);
CREATE TABLE Partie(
idPartie char(5) NOT NULL,
joueur varchar(50) REFERENCES Joueur(email),
enigme char(5) REFERENCES Enigme(idEnigme),
points numeric CHECK (points >0),
PRIMARY KEY(idGame, joueur, enigme)
);
CREATE TABLE DetailPartie(
idPartie char(5) NOT NULL,
joueur varchar(50) REFERENCES Joueur(email),
enigme char(5) REFERENCES Enigme(idEnigme),
points numeric CHECK (points >0),
PRIMARY KEY(idGame, joueur, enigme)
);

@ -13,3 +13,4 @@ $vues['erreur']='View/Error/Erreur.php';
$vues['erreurBd']='View/Error/ErreurBd.php'; $vues['erreurBd']='View/Error/ErreurBd.php';
$vues['erreurLoginEmail']='View/Error/ErreurLoginEmail.php'; $vues['erreurLoginEmail']='View/Error/ErreurLoginEmail.php';
$vues['erreurLoginMdp']='View/Error/ErreurLoginMdp.php'; $vues['erreurLoginMdp']='View/Error/ErreurLoginMdp.php';
$vues['erreur404']='View/Error/Erreur404.php';

@ -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']);
}
}
} }

@ -1,6 +1,4 @@
<?php <?php
require_once "../Config/Connection.php";
require_once "../Model/Enigme.php";
class EnigmeGateway class EnigmeGateway
{ {

@ -1,8 +1,5 @@
<?php <?php
require_once "../Model/Joueur.php";
require_once "../Config/Connection.php";
class JoueurGateway class JoueurGateway
{ {
private Connection $con; private Connection $con;

@ -1,6 +0,0 @@
<?php
require_once 'Controller.php';
require_once '../Config/Config.php';
$con = new Connection($dsn, $user, $password);
$control = new Controller($con);

@ -7,5 +7,3 @@
?> ?>
</body> </body>
</html> </html>
<?php

@ -0,0 +1,9 @@
<html>
<body>
<h1>ERREUR</h1>
<p>Page introuvable</p>
<?php
?>
</body>
</html>

@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../../CSS/LogSign.css"> <link rel="stylesheet" href="./View/src/CSS/LogSign.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script defer src="../../JS/Login.js"></script> <script defer src="../../JS/Login.js"></script>
<title>Login</title> <title>Login</title>
@ -15,7 +15,7 @@
<div class="top"> <div class="top">
<h2>Sign up</h2> <h2>Sign up</h2>
</div> </div>
<form action="../../../../Controller/Traitement.php?action=login" method="POST"> <form action="index.php?action=login" method="POST">
<div class="user-box"> <div class="user-box">
<input type="text" id="email" name="email" required=""> <input type="text" id="email" name="email" required="">
<label>Email</label> <label>Email</label>
@ -32,7 +32,7 @@
<span></span> <span></span>
Submit Submit
</button> </button>
<a href="SignUp.php" class="right"> <a href="index.php?action=goToSignUp" class="right">
<span></span> <span></span>
<span></span> <span></span>
<span></span> <span></span>

@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../../CSS/LogSign.css"> <link rel="stylesheet" href="./View/src/CSS/LogSign.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script defer src="../../JS/SignUp.js"></script> <script defer src="../../JS/SignUp.js"></script>
<title>Login</title> <title>Login</title>
@ -15,7 +15,7 @@
<div class="top"> <div class="top">
<h2>Sign up</h2> <h2>Sign up</h2>
</div> </div>
<form action="../../../../Controller/Traitement.php?action=signUp" method="POST"> <form action="index.php?action=signUp" method="POST">
<div class="user-box"> <div class="user-box">
<input type="email" id="email" name="email" required=""> <input type="email" id="email" name="email" required="">
<label>Email</label> <label>Email</label>

@ -16,7 +16,7 @@
integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU"
crossorigin="anonymous" crossorigin="anonymous"
/> />
<link rel="stylesheet" href="../CSS/Main.css" /> <link rel="stylesheet" href="./View/src/CSS/Main.css" />
</head> </head>
@ -34,12 +34,20 @@
</h1> </h1>
</div> </div>
<div class="row d-flex justify-content-center g-5 py-5"> <div class="row d-flex justify-content-center g-5 py-5">
<a <a
id="enigme" id="enigme"
class="mb-3 text-uppercase d-flex justify-content-center align-items-center" class="mb-3 text-uppercase d-flex justify-content-center align-items-center"
href="Presentation.html" style="width: 260px; height: 50px"
style="width: 260px; height: 50px" <?php
> if (isset($_SESSION['connected']) && $_SESSION['connected'] == 'true'){
echo 'href="index.php?action=goToPresentation"';
}
else{
echo 'href="index.php?action=goToLogin"';
}
?>
>
<span></span>
<span></span> <span></span>
<span></span> <span></span>
<span></span> <span></span>

@ -4,9 +4,9 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../CSS/Enigme.css"> <link rel="stylesheet" href="./View/src/CSS/Enigme.css">
<link rel="stylesheet" href="../CSS/Home.css"> <link rel="stylesheet" href="./View/src/CSS/Home.css">
<link rel="stylesheet" href="../CSS/Presentation.css"> <link rel="stylesheet" href="./View/src/CSS/Presentation.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<title>Presentation</title> <title>Presentation</title>
</head> </head>
@ -14,7 +14,7 @@
<div class="presentation_titre" id="home"> <div class="presentation_titre" id="home">
<div class="titre_pre"> <div class="titre_pre">
<div class="retour"> <div class="retour">
<a class="material-icons" id="home" href="Home.html" style="font-size:64px;color:white;">home</a> <a class="material-icons" id="home" href="index.php?action=goToHome" style="font-size:64px;color:white;">home</a>
</div> </div>
<div class="sign"> <div class="sign">
<h1> <h1>

@ -0,0 +1,24 @@
<?php
require_once './Config/Config.php';
require_once "./Config/Connection.php";
require_once './Config/Validation.php';
require_once "./Model/Joueur.php";
require_once "./Model/Enigme.php";
require_once './Controller/JoueurGateway.php';
require_once './Controller/EnigmeGateway.php';
require_once './Controller/JoueurNotFoundException.php';
require_once './Controller/InvalidMdpException.php';
require_once './Controller/Controller.php';
//unset($_SESSION['connected']);
$con = new Connection($dsn, $user, $password);
$control = new Controller($con);
session_unset(); //efface les variable session
session_destroy();//détruit la session
$_SESSION = null;//histoire d'être sûre

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/php.iml" filepath="$PROJECT_DIR$/.idea/php.iml" />
</modules>
</component>
</project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PhpProjectSharedConfiguration" php_language_level="7">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
</project>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
</component>
</project>
Loading…
Cancel
Save