X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Flogs.cgi%2Fproxylog.dat;h=e529be061df78e9f4419e3ebddb6d1cf14cf3209;hb=765c3d050ce50195103eecbeb628a594a16d274a;hp=f790e2ff18b4f83d1e50e912e6d624912274c021;hpb=cd1a2927226c734d96478e12bb768256fb64a06a;p=people%2Fpmueller%2Fipfire-2.x.git diff --git a/html/cgi-bin/logs.cgi/proxylog.dat b/html/cgi-bin/logs.cgi/proxylog.dat index f790e2ff18..e529be061d 100644 --- a/html/cgi-bin/logs.cgi/proxylog.dat +++ b/html/cgi-bin/logs.cgi/proxylog.dat @@ -6,8 +6,6 @@ # # (c) The SmoothWall Team # -# $Id: proxylog.dat,v 1.4.2.25 2005/07/07 17:32:24 eoberlander Exp $ -# use strict; @@ -15,7 +13,7 @@ use strict; #use warnings; #use CGI::Carp 'fatalsToBrowser'; -require 'CONFIG_ROOT/general-functions.pl'; +require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; @@ -28,11 +26,17 @@ undef (@dummy); my %cgiparams=(); my %logsettings=(); my %ips=(); +my %users=(); my %selected=(); my %checked=(); my @log=(); my $errormessage = ''; +my %color = (); +my %mainsettings = (); +&General::readhash("${General::swroot}/main/settings", \%mainsettings); +&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); + my @shortmonths = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ); my @longmonths = ( $Lang::tr{'january'}, $Lang::tr{'february'}, $Lang::tr{'march'}, @@ -86,6 +90,7 @@ if ($ENV{'QUERY_STRING'} && $cgiparams{'ACTION'} ne $Lang::tr{'update'}) $cgiparams{'MONTH'} = $temp[1]; $cgiparams{'DAY'} = $temp[2]; $cgiparams{'SOURCE_IP'} = $temp[3]; + $cgiparams{'USERNAME'} = $temp[4]; } if (!($cgiparams{'MONTH'} =~ /^(0|1|2|3|4|5|6|7|8|9|10|11)$/) || @@ -168,6 +173,8 @@ my $daystr = $cgiparams{'DAY'} == 0 ? '' :$cgiparams{'DAY'} <= 9 ? "0$cgiparams{ my $filter = $cgiparams{'ENABLE_FILTER'} eq 'on' ? $cgiparams{'FILTER'} : ''; my $sourceip = $cgiparams{'SOURCE_IP'}; my $sourceall = $cgiparams{'SOURCE_IP'} eq 'ALL' ? 1 : 0; +my $username = $cgiparams{'USERNAME'}; +my $usersall = $cgiparams{'USERNAME'} eq 'ALL' ? 1 : 0; my $lines = 0; my $temp = (); @@ -217,21 +224,23 @@ if ($@ ne '') READ:while () { my ($datetime,$do,$ip,$ray,$me,$far,$url,$so) = split; $ips{$ip}++; + $users{$so}++; # for debug #$lastdatetime = $datetime; # collect lines between date && filter if (( ($datetime>$mintime)&&($datetime<$maxtime)) && !($url =~ /$filter/) && - ((($ip eq $sourceip) || $sourceall))) + ((($ip eq $sourceip) || $sourceall)) && + ((($so eq $username) || $usersall))) { # when standart viewing, just keep in memory the correct slices # it starts a '$start' and size is $viewport # If export, then keep all lines... if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}){ - $log[$lines++] = "$datetime $ip $url"; + $log[$lines++] = "$datetime $ip $so $url"; } else { if ($lines++ < ($start + $Header::viewsize)) { - push(@log,"$datetime $ip $url"); + push(@log,"$datetime $ip $so $url"); if (@log > $Header::viewsize) { shift (@log); } @@ -247,7 +256,7 @@ if ($@ ne '') } close (FILE); } - $gzindex--; # will try next gz file eg 40,39,38,.... because it may have holes when ipcop stopped + $gzindex--; # will try next gz file eg 40,39,38,.... because it may have holes when ipfire stopped # for a long time } @@ -268,9 +277,10 @@ if ($@ ne '') if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}) { print "Content-type: text/plain\n\n"; - print "IPCop proxy log\r\n"; + print "IPFire proxy log\r\n"; print "$Lang::tr{'date'}: $daystr\r\n"; print "Source IP: $cgiparams{'SOURCE_IP'}\r\n"; + print "Username: $cgiparams{'USERNAME'}\r\n"; if ($cgiparams{'ENABLE_FILTER'} eq 'on') { print "Ignore filter: $cgiparams{'FILTER'}\r\n"; } print "\r\n"; @@ -278,22 +288,23 @@ if ($cgiparams{'ACTION'} eq $Lang::tr{'export'}) if ($logsettings{'LOGVIEW_REVERSE'} eq 'on') { @log = reverse @log; } foreach $_ (@log) { - my ($datetime,$ip,$url) = split; + my ($datetime,$ip,$so,$url) = split; my ($SECdt, $MINdt, $HOURdt, $DAYdt, $MONTHdt, $YEARdt) = localtime($datetime); $SECdt = sprintf ("%.02d",$SECdt); $MINdt = sprintf ("%.02d",$MINdt); $HOURdt = sprintf ("%.02d",$HOURdt); if ($cgiparams{'DAY'}==0) { # full month $DAYdt = sprintf ("%.02d",$DAYdt); - print "$DAYdt/$HOURdt:$MINdt:$SECdt $ip $url\n"; + print "$DAYdt/$HOURdt:$MINdt:$SECdt $ip $so $url\n"; } else { - print "$HOURdt:$MINdt:$SECdt $ip $url\n"; + print "$HOURdt:$MINdt:$SECdt $ip $so $url\n"; } } exit; } $selected{'SOURCE_IP'}{$cgiparams{'SOURCE_IP'}} = "selected='selected'"; +$selected{'USERNAME'}{$cgiparams{'USERNAME'}} = "selected='selected'"; $checked{'ENABLE_FILTER'}{'off'} = ''; $checked{'ENABLE_FILTER'}{'on'} = ''; @@ -357,12 +368,26 @@ print <$Lang::tr{'caps all'} END ; -foreach my $ip (keys %ips) { +foreach my $ip (sort keys %ips) { print "\n"; } print < + +   + $Lang::tr{'advproxy NCSA username'}: + + @@ -415,7 +440,8 @@ print < $Lang::tr{'time'} $Lang::tr{'source ip'} -$Lang::tr{'website'} +$Lang::tr{'advproxy NCSA username'} +$Lang::tr{'website'} END ; @@ -423,10 +449,10 @@ my $ll = 0; foreach $_ (@log) { if ($ll % 2) { - print "\n"; } + print "\n"; } else { - print "\n"; } - my ($datetime,$ip,$url) = split; + print "\n"; } + my ($datetime,$ip,$so,$url) = split; my ($SECdt, $MINdt, $HOURdt, $DAYdt, $MONTHdt, $YEARdt) = localtime($datetime); $SECdt = sprintf ("%.02d",$SECdt); $MINdt = sprintf ("%.02d",$MINdt); @@ -445,6 +471,7 @@ foreach $_ (@log) print <$DAYdt$HOURdt:$MINdt:$SECdt $ip + $so $part END @@ -473,14 +500,14 @@ END print ""; if ($prev != -1) { - print "$Lang::tr{'older'}"; } + print "$Lang::tr{'older'}"; } else { print "$Lang::tr{'older'}"; } print "\n"; print ""; if ($next >= 0 ) { - print "$Lang::tr{'newer'}"; } + print "$Lang::tr{'newer'}"; } else { print "$Lang::tr{'newer'}"; } print "\n";