2009-06-30 09:22:30 +00:00
|
|
|
<?php
|
2009-06-30 11:52:55 +00:00
|
|
|
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/logout.php,v 1.20.2.2 2008/12/12 12:20:22 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 11:52:55 +00:00
|
|
|
error(_('No one is logged in to that server.'),'error','index.php');
|
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')
|
2009-06-30 11:52:55 +00:00
|
|
|
$ldapserver->unsetLoginDN() or error(_('Could not logout.'),'error','index.php');
|
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 11:52:55 +00:00
|
|
|
error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type)),'error','index.php');
|
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
|
|
|
?>
|