From d582d90c532bffb83437aa528c249a4dd0fc8b67 Mon Sep 17 00:00:00 2001 From: arensb Date: Fri, 11 Oct 2002 12:50:42 +0000 Subject: [PATCH] Replaced &requireDBI with C4::Context->dbh, thus making the "use Database" statement unnecessary. Replaced a prepare()/execute() with a do(). --- opac/opac-logout.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/opac/opac-logout.pl b/opac/opac-logout.pl index 969e77d832..1d707135d1 100755 --- a/opac/opac-logout.pl +++ b/opac/opac-logout.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl use CGI; -use C4::Database; +use C4::Context; use C4::Output; my $query=new CGI; @@ -27,6 +27,7 @@ browser. my $sessions; open (S, "/tmp/sessions"); + # FIXME - Come up with a better logging mechanism while (my ($sid, $u, $lasttime) = split(/:/, )) { chomp $lasttime; (next) unless ($sid); @@ -41,7 +42,7 @@ foreach (keys %$sessions) { print S "$_:$userid:$lasttime\n"; } -my $dbh=C4Connect; +my $dbh = C4::Context->dbh; # Check that this is the ip that created the session before deleting it @@ -56,8 +57,7 @@ if ($sth->rows) { } } -$sth=$dbh->prepare("delete from sessions where sessionID=?"); -$sth->execute($sessionID); +$dbh->do("delete from sessions where sessionID=?", $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; -- 2.39.5