From 85636b5cf1d3f36c53db1c18f28f10ff18c71403 Mon Sep 17 00:00:00 2001 From: Paul POULAIN Date: Thu, 27 Sep 2007 18:58:19 +0200 Subject: [PATCH] BUGFIX : updating opac-logout to deal with CGI::Sessions Signed-off-by: Chris Cormack --- opac/opac-logout.pl | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/opac/opac-logout.pl b/opac/opac-logout.pl index 1a877e63dd..728144252a 100755 --- a/opac/opac-logout.pl +++ b/opac/opac-logout.pl @@ -23,34 +23,7 @@ my $query = new CGI; my $sessionID = $query->cookie('sessionID'); my $dbh = C4::Context->dbh; -# Check that this is the ip that created the session before deleting it -my $sth = $dbh->prepare("select userid,ip from sessions where sessionID=?"); -$sth->execute($sessionID); -my ( $userid, $ip ); -if ( $sth->rows ) { - ( $userid, $ip ) = $sth->fetchrow; - if ( $ip ne $ENV{'REMOTE_ADDR'} ) { - - # attempt to logout from a different ip than cookie was created at - exit; - } -} - -$sth = $dbh->prepare("delete from sessions where sessionID=?"); -$sth->execute($sessionID); -open L, ">>/tmp/sessionlog"; -my $time = localtime( time() ); -printf L "%20s from %16s logged out at %30s (manual log out).\n", $userid, $ip, - $time; -close L; - -my $cookie = $query->cookie( - -name => 'sessionID', - -value => '', - -expires => '+1y' -); - -# Should redirect to opac home page after logging out +C4::Context->_unset_userenv($sessionID); print $query->redirect("/cgi-bin/koha/opac-main.pl"); -- 2.39.5