projetphp/index.php

60 lines
1.2 KiB
PHP
Executable File

<?php
define('SITE_ROOT', dirname(__FILE__));
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
session_start();
if(isset($_POST["sessionDestroy"]))
{
session_destroy();
header('Location: index.php');
}
if(!isset($_SESSION["sl"]))
{
$_SESSION["sl"] = "1";
$_SESSION["login"] = "";
}
require_once SITE_ROOT.'/vendor/autoload.php';
$loader = new Twig_Loader_Filesystem( SITE_ROOT.'/views');
$twig = new Twig_Environment($loader, array(
'cache' => /*SITE_ROOT.'/twig/compilation_cache'*/false,
));
if(isset($_GET["page"]))
{
switch ($_GET["page"]) {
case 'table':
include './control/table.php';
break;
case 'login':
include './control/login.php';
break;
default:
include './control/login.php';
break;
}
}
else {
if(isset($_SESSION["sl"]))
switch ($_SESSION["sl"]) {
case '5':
case '10':
include './control/table.php';
break;
default:
if(!empty($_SESSION["login"]))
include './control/table.php';
else
include './control/login.php';
break;
}
else
include './control/login.php';
}
?>