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
|
||||
//préfixe
|
||||
$rep='../';
|
||||
$rep = __DIR__ . '/../';
|
||||
|
||||
//BD
|
||||
|
||||
$dsn = 'mysql:host=londres.uca.local; dbname=dbnogarnier1';
|
||||
$user = 'nogarnier1';
|
||||
$password = 'achanger';
|
||||
|
||||
// $dsn = 'mysql:host=localhost; dbname=scripted';
|
||||
// $user = 'root';
|
||||
// $password = 'p';
|
||||
|
||||
//View
|
||||
$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';
|
||||
//Page
|
||||
$vues['main'] = 'View/src/pages/Main.php';
|
||||
$vues['presenation'] = 'View/src/pages/Presentation.html';
|
||||
$vues['login'] = 'View/src/pages/LogSign/Login.php';
|
||||
$vues['signUp'] = 'View/src/pages/LogSign/SignUp.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
|
||||
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']);
|
||||
require_once(__DIR__.'/config/config.php');
|
||||
require_once(__DIR__.'/config/Autoload.php');
|
||||
Autoload::charger();
|
||||
|
||||
$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
|
||||
session_unset();
|
||||
session_destroy();
|
||||
$_SESSION = null;
|
Loading…
Reference in new issue