From c99932df839dcac771392e5963bce5cf5b223118 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Fri, 13 Jan 2017 18:17:31 +0100 Subject: [PATCH] Logout management (uri: 'logout' ou 'logout/') --- public_html/index.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/public_html/index.php b/public_html/index.php index e40804a..1076bc3 100755 --- a/public_html/index.php +++ b/public_html/index.php @@ -81,6 +81,11 @@ if( $auth == 2 ){ + // logout from admin + $R->get('logout/?', function(){ + (new ModuleRequest('authentificationDefault/admin', ['username' => '0', 'password' => '']))->dispatch(); + header('Location: /'); + }); // nomPage/arg1/arg2 -> inclusion de la page $R->get('(.*)', function($m){ @@ -98,6 +103,14 @@ /* (3) Si on est pas authentifié */ }else if( $auth == 1 ){ + // warehouse logout + $R->get('logout/?', function(){ + (new ModuleRequest('authentificationDefault/warehouse', ['name' => '000', 'password' => '']))->dispatch(); + header('Location: /'); + }); + + + // admin login page $R->get('(.*)', function($m){ if( !preg_match('#^admin/$#', $m[0]) ) header(__REDIRECT__); else include __PUBLIC__.'/view/admin.php'; @@ -116,7 +129,7 @@ /* (4) api/module/method -> Api */ - $R->post('api(?:/(.*))/??', function($url){ + $R->post('api(?:/(.*))/?', function($url){ $request = ModuleRequest::fromPost($url, $_POST); $answer = $request->dispatch(); @@ -128,7 +141,7 @@ }); - /* (5) N'importe -> page d'accueil */ + /* (6) N'importe -> page d'accueil */ $R->get('.+', function(){ header(__REDIRECT__); }); $R->post('.+', function(){ header(__REDIRECT__); });