#!/usr/local/bin/perl -w ############################################################################### # Program clear_session # $Id: $ # # Description : Clear information from session hash # # SBEAMS is Copyright (C) 2000-2011 Institute for Systems Biology # This program is governed by the terms of the GNU General Public License (GPL) # version 2 as published by the Free Software Foundation. It is provided # WITHOUT ANY WARRANTY. See the full description of GPL terms in the # LICENSE file distributed with this software. # ############################################################################### use strict; use lib qw (../lib/perl); use File::Basename; use Benchmark; use SBEAMS::Connection qw($q $log); use SBEAMS::Connection::Settings; ## Globals ## my $sbeams = new SBEAMS::Connection; # Don't buffer output $|++; { # Main # Authenticate user. my $current_username = $sbeams->Authenticate( allow_anonymous_access => 1 ) || die "Authentication failed"; # Print cgi headers $sbeams->printPageHeader( onload => 'clear_cookie()' ); print qq~ ~; my $content = $sbeams->showSessionHash() || $sbeams->makeInactiveText( "N/A" ); my $hash = $sbeams->getSessionAttribute( 'key' => 'returnEntireSessionHash' ); if ( ! $hash ) { $log->warn( "session file doesn't yet exist " ); $hash = {}; } else { for my $k ( sort( keys( %$hash ) ) ) { $sbeams->deleteSessionAttribute( key => $k ); } } $hash = $sbeams->getSessionAttribute( 'key' => 'returnEntireSessionHash' ); if ( !defined $hash ) { $log->warn( "session file doesn't yet exist " ); $hash = {}; } print "Existing Settings:
$content \n\n All session cookies cleared!\n
"; my $new_content = $sbeams->showSessionHash() || $sbeams->makeInactiveText( "N/A" ); print "New Settings:
$new_content


\n"; $sbeams->printPageFooter( close_tables=>'NO'); } # end Main