Description:
This logs the user out from all computers they've used to log in to the scoop site. Useful if you use computers that aren't yours and can't remember if you logged out or not.
Based on the logout box, mostly for the redirect stuff.
Note that this doesn't remove the cookie from the other computer - what it does is remove the session line in the database that ties the cookie to the user's UID. The other computer still has the cookie and it still has session information such as comment display, but is anonymous instead of logged in.
Box Code:
my $logout_url = $S->var('logout_url')
\|\| ($S->var('rootdir') . '/');
my $uid = $S->dbh->quote($S->{UID});
my ($rv,$sth) = $S->db_delete({
FROM => 'sessions',
WHERE => "item='UID' AND value=$uid"
});
$S->{APACHE}->headers_out->{'Location'} = "$logout_url";
# the following is probably unneccesary,
# but just in case...
return { content => qq{Redirecting to <a href="$logout_url">$logout_url</a>} }
|