diff --git a/build/router/controller/page.php b/build/router/controller/page.php index e1294af..3abe07e 100644 --- a/build/router/controller/page.php +++ b/build/router/controller/page.php @@ -33,19 +33,43 @@ } + /* (2) Only teacher */ + if( !in_array('cas_admin', $_SESSION['AUTH']) ){ + + // redirection + if( $this->pagename != "fiche" ){ + header('Location: /fiche/'); + die(); + } + + // deconnection + if( $this->uri == 'logout' || $this->uri == 'logout/' ){ + + \session_destroy(); + header('Location: /'); + die(); + + } + + // load page + include __PUBLIC__."/page/fiche.php"; + die(); + + } - /* (1) Build page file name */ + + /* (3) Build page file name */ $page_fname = __PUBLIC__."/page/".$this->pagename.".php"; - /* (2) If page does not exist -> 404 */ + /* (4) If page does not exist -> 404 */ if( !file_exists($page_fname) ) include __PUBLIC__.'/page/404.php'; - /* (3) Set URI arguments */ + /* (5) Set URI arguments */ $_GET['uri'] = explode('/', $this->uri); - /* (4) Load page */ + /* (6) Load page */ include __PUBLIC__."/page/".$this->pagename.".php"; } diff --git a/public_html/page/fiche.php b/public_html/page/fiche.php new file mode 100644 index 0000000..23a32a6 --- /dev/null +++ b/public_html/page/fiche.php @@ -0,0 +1,35 @@ + + +
+ + + + + + +