2009-06-30 09:22:30 +00:00
|
|
|
<?php
|
2009-06-30 11:46:44 +00:00
|
|
|
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/logout.php,v 1.20.2.1 2007/12/26 03:25:38 wurley Exp $
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
/**
|
|
|
|
* For servers whose auth_type is set to 'cookie' or 'session'. Pass me
|
2009-06-30 09:22:30 +00:00
|
|
|
* the server_id and I will log out the user (delete the cookie)
|
|
|
|
*
|
2009-06-30 09:29:51 +00:00
|
|
|
* Variables that come in via common.php
|
2009-06-30 09:22:30 +00:00
|
|
|
* - server_id
|
2009-06-30 09:29:51 +00:00
|
|
|
*
|
|
|
|
* @package phpLDAPadmin
|
|
|
|
*/
|
|
|
|
/**
|
2009-06-30 09:22:30 +00:00
|
|
|
*/
|
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
require './common.php';
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
if (! $ldapserver->haveAuthInfo())
|
2009-06-30 10:26:08 +00:00
|
|
|
pla_error(_('No one is logged in to that server.'));
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 10:46:00 +00:00
|
|
|
if (in_array($ldapserver->auth_type, array('cookie','session','http'))) {
|
2009-06-30 10:26:08 +00:00
|
|
|
syslog_notice (sprintf('Logout for %s',$ldapserver->getLoggedInDN()));
|
2009-06-30 10:46:00 +00:00
|
|
|
if($ldapserver->auth_type!='http')
|
|
|
|
$ldapserver->unsetLoginDN() or pla_error(_('Could not logout.'));
|
2009-06-30 09:29:51 +00:00
|
|
|
unset_lastactivity($ldapserver);
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 10:46:00 +00:00
|
|
|
@session_destroy();
|
2009-06-30 10:26:08 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
} else
|
2009-06-30 10:26:08 +00:00
|
|
|
pla_error(sprintf(_('Unknown auth_type: %s'), htmlspecialchars($ldapserver->auth_type)));
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 10:46:00 +00:00
|
|
|
system_message(array(
|
|
|
|
'title'=>_('Logout'),
|
|
|
|
'body'=>('Logged out successfully from server.'),
|
|
|
|
'type'=>'info'),
|
2009-06-30 11:46:44 +00:00
|
|
|
sprintf('index.php?server_id=%s',$ldapserver->server_id));
|
2009-06-30 09:22:30 +00:00
|
|
|
?>
|