parent
e12271a57c
commit
8045f7f375
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Autoload
|
||||||
|
{
|
||||||
|
private static $_instance = null;
|
||||||
|
|
||||||
|
public static function charger()
|
||||||
|
{
|
||||||
|
if(null !== self::$_instance) {
|
||||||
|
throw new RuntimeException(sprintf('%s is already started', __CLASS__));
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$_instance = new self();
|
||||||
|
|
||||||
|
|
||||||
|
if(!spl_autoload_register(array(self::$_instance, '_autoload'), false)) {
|
||||||
|
throw new RuntimeException(sprintf('%s : Could not start the autoload', __CLASS__));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function shutDown()
|
||||||
|
{
|
||||||
|
if(null !== self::$_instance) {
|
||||||
|
|
||||||
|
if(!spl_autoload_unregister(array(self::$_instance, '_autoload'))) {
|
||||||
|
throw new RuntimeException('Could not stop the autoload');
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$_instance = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function _autoload($class)
|
||||||
|
{
|
||||||
|
global $rep;
|
||||||
|
$filename = $class.'.php';
|
||||||
|
$dir =array('Model/','./','Config/','Controller/');
|
||||||
|
foreach ($dir as $d){
|
||||||
|
$file=$rep.$d.$filename;
|
||||||
|
//echo $file;
|
||||||
|
if (file_exists($file))
|
||||||
|
{
|
||||||
|
include $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
@ -1,16 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
//préfixe
|
//préfixe
|
||||||
$rep='../';
|
$rep = __DIR__ . '/../';
|
||||||
|
|
||||||
//BD
|
//BD
|
||||||
|
|
||||||
$dsn = 'mysql:host=londres.uca.local; dbname=dbnogarnier1';
|
$dsn = 'mysql:host=londres.uca.local; dbname=dbnogarnier1';
|
||||||
$user = 'nogarnier1';
|
$user = 'nogarnier1';
|
||||||
$password = 'achanger';
|
$password = 'achanger';
|
||||||
|
|
||||||
|
// $dsn = 'mysql:host=localhost; dbname=scripted';
|
||||||
|
// $user = 'root';
|
||||||
|
// $password = 'p';
|
||||||
|
|
||||||
//View
|
//View
|
||||||
$vues['erreurSignUp']='View/Error/ErreurSignUp.php';
|
//Page
|
||||||
$vues['erreur']='View/Error/Erreur.php';
|
$vues['main'] = 'View/src/pages/Main.php';
|
||||||
$vues['erreurBd']='View/Error/ErreurBd.php';
|
$vues['presenation'] = 'View/src/pages/Presentation.html';
|
||||||
$vues['erreurLoginEmail']='View/Error/ErreurLoginEmail.php';
|
$vues['login'] = 'View/src/pages/LogSign/Login.php';
|
||||||
$vues['erreurLoginMdp']='View/Error/ErreurLoginMdp.php';
|
$vues['signUp'] = 'View/src/pages/LogSign/SignUp.php';
|
||||||
$vues['erreur404']='View/Error/Erreur404.php';
|
|
||||||
|
//Error
|
||||||
|
$vues['erreurSignUp'] = 'View/Error/ErreurSignUp.php';
|
||||||
|
$vues['erreur'] = 'View/Error/Erreur.php';
|
||||||
|
$vues['erreurBd'] = 'View/Error/ErreurBd.php';
|
||||||
|
$vues['erreurLoginEmail'] = 'View/Error/ErreurLoginEmail.php';
|
||||||
|
$vues['erreurLoginMdp'] = 'View/Error/ErreurLoginMdp.php';
|
||||||
|
$vues['erreur404'] = 'View/Error/Erreur404.php';
|
||||||
|
@ -1,24 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once './Config/Config.php';
|
require_once(__DIR__.'/config/config.php');
|
||||||
require_once "./Config/Connection.php";
|
require_once(__DIR__.'/config/Autoload.php');
|
||||||
require_once './Config/Validation.php';
|
Autoload::charger();
|
||||||
|
|
||||||
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);
|
$con = new Connection($dsn, $user, $password);
|
||||||
$control = new Controller($con);
|
$control = new Controller($con);
|
||||||
|
|
||||||
session_unset(); //efface les variable session
|
session_unset();
|
||||||
session_destroy();//détruit la session
|
session_destroy();
|
||||||
$_SESSION = null;//histoire d'être sûre
|
$_SESSION = null;
|
Loading…
Reference in new issue