Jump to content

Logout script to trigger logging out anywhere


Truemedia

Recommended Posts

Hi, Just thought this would be really useful to a lot of people wanting to integrate phpVMS with other software. This is a code snippet that will allow you to logout of phpvms regardless of where the script is or where it's called from. Just make sure the directory to you codon file is correct and everything should work fine ;) .

Here is the code below (basically the logout function of the auth class but written out instead of referenced to avoid execute problems):

<?php
require("../../phpvms/core/codon.config.php");
#self::remove_sessions(SessionManager::GetValue('userinfo', 'pilotid'));

# Mark them as guest
Auth::update_session(Auth::$session_id, 0);

# "Ghost" entry
//self::start_session(self::$userinfo->pilotid); // Orphaned?

SessionManager::Set('loggedin', false);
SessionManager::Set('userinfo', '');
SessionManager::Set('usergroups', '');

# Delete cookie

$_COOKIE['VMSAUTH'] = '';
setcookie("VMSAUTH", false, time() - 3600*24*30, "/");

Auth::$loggedin = false;
?>

Hope this helps anyone that was looking for it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...