[pmwiki-users] fake logout
Hans
design at flutesong.net
Tue Mar 8 03:28:27 CST 2005
Tuesday, March 8, 2005, 6:39:58 AM, Radu wrote:
> I've been trying to do the following:
> %green%'''''Welcome, (:if author :){$Author}'''''%%
> ([[{$Name}?action=logout|logout]])
> *[[{$Name}?action=edit | Edit]](:if !author:)Guest'''''%%
> *[[Main/Login]](:if:)
> After defining logout and a conditional for author in config.php
> if ($action == 'logout') $GLOBALS['Author']='';
> $Conditions['author'] = "\$GLOBALS['Author']!=\$condparm";
> This is in no way an interface for UserAuth; I would simply like to allow
> people to remove their Author session string within the current
> Authentication scheme.
> Problem: the Author change does not seem to 'stick'; it works once clicked,
> but if moving to another page, the cookie restores it. Should I set the
> author cookie on logout to expire $Now?
##adds action=logout
global $HandleActions;
SDV($HandleActions['logout'], 'HandleLogout');
function HandleLogout($pagename) {
session_start();
session_unset();
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time() - 42000, '/');
}
if (isset($_COOKIE['author'])) {
setcookie('author', '', time() - 42000, '/');
}
session_destroy();
Redirect('Main.Logout');
}
I modified this code snippet from Dominique Faure, I think, adding the
unsetting of author cookie
Best,
~Hans
More information about the pmwiki-users
mailing list