BIG FIX: session_name with logout ....

This commit is contained in:
xdrm-brackets 2017-12-08 00:32:18 +01:00 committed by SeekDaSky
parent bdf119700c
commit 1400d445ee
5 changed files with 38 additions and 6 deletions

View File

@ -25,11 +25,13 @@
public static function check(){ public static function check(){
/* (1) Initialisation /* (1) Initialisation
---------------------------------------------------------*/ ---------------------------------------------------------*/
if( !isset($_SESSION['TOKEN']) ) $_SESSION['TOKEN'] = []; if( !isset($_SESSION['TOKEN']) ) $_SESSION['TOKEN'] = [];
if( !isset($_SESSION['AUTH']) ) $_SESSION['AUTH'] = []; if( !isset($_SESSION['AUTH']) ) $_SESSION['AUTH'] = [];
if( !isset($_SESSION['PERM']) ) $_SESSION['PERM'] = []; if( !isset($_SESSION['PERM']) ) $_SESSION['PERM'] = [];
if( !isset($_SESSION['USER']) ) $_SESSION['USER'] = []; if( !isset($_SESSION['USER']) ) $_SESSION['USER'] = [];
if( !isset($_SESSION['ADMIN']) ) $_SESSION['ADMIN'] = []; if( !isset($_SESSION['ADMIN']) ) $_SESSION['ADMIN'] = [];
if( !isset($_SESSION['NAME']) ) $_SESSION['NAME'] = '';
if( !isset($_SESSION['WS']) ) $_SESSION['WS'] = true;
/* (2) Gestion de AUTH (authentification) /* (2) Gestion de AUTH (authentification)

View File

@ -52,6 +52,7 @@ class admin{
---------------------------------------------------------*/ ---------------------------------------------------------*/
/* (1) Update session */ /* (1) Update session */
$_SESSION['TOKEN'] = 'a'.$fetched_admin['token']; $_SESSION['TOKEN'] = 'a'.$fetched_admin['token'];
$_SESSION['WS'] = true; // to tell websocket we are connected
new AuthSystemDefault; new AuthSystemDefault;
/* (2) Return status */ /* (2) Return status */
@ -105,4 +106,10 @@ class admin{
} }
public function DELETE_logout(){
$_SESSION = [];
}
} }

View File

@ -52,6 +52,7 @@ class user{
---------------------------------------------------------*/ ---------------------------------------------------------*/
/* (1) Update session */ /* (1) Update session */
$_SESSION['TOKEN'] = 'u'.$fetched_user['token']; $_SESSION['TOKEN'] = 'u'.$fetched_user['token'];
$_SESSION['WS'] = true; // to tell websocket we are connected
new AuthSystemDefault; new AuthSystemDefault;
/* (2) Return status */ /* (2) Return status */
@ -104,4 +105,10 @@ class user{
} }
public function DELETE_logout(){
$_SESSION = [];
}
} }

View File

@ -27,7 +27,7 @@
*/ */
public function load(){ public function load(){
if( !isset($_SESSION['NAME']) || strlen($_SESSION['NAME']) == 0 ){ if( $_SESSION['WS'] || strlen($_SESSION['NAME']) == 0 ){
// ask with websocketInterop // ask with websocketInterop
$wsi = new wsinterop('localhost', 9998); $wsi = new wsinterop('localhost', 9998);
@ -63,6 +63,8 @@
$wsi->close(); $wsi->close();
$wsi = null; $wsi = null;
$_SESSION['WS'] = false;
} }
if( file_exists(__ROOT__."/view/home.php") ) if( file_exists(__ROOT__."/view/home.php") )
include __ROOT__."/view/home.php"; include __ROOT__."/view/home.php";

View File

@ -25,6 +25,13 @@
"output": { "output": {
"registered": { "description": "UID du nouvel administrateur", "type": "id" } "registered": { "description": "UID du nouvel administrateur", "type": "id" }
} }
},
"DELETE logout": {
"description": "Déconnexion utilisateur",
"permissions": [],
"parameters": {},
"output": {}
} }
}, },
@ -56,6 +63,13 @@
"output": { "output": {
"registered": { "description": "UID du nouvel utilisateur", "type": "id" } "registered": { "description": "UID du nouvel utilisateur", "type": "id" }
} }
},
"DELETE logout": {
"description": "Déconnexion utilisateur",
"permissions": [],
"parameters": {},
"output": {}
} }
}, },