Revision: 6369
http://ipcop.svn.sourceforge.net/ipcop/?rev=6369&view=rev
Author: owes
Date: 2012-02-18 21:54:22 +0000 (Sat, 18 Feb 2012)
Log Message:
-----------
Add username to proxy log view.
Modified Paths:
--------------
ipcop/trunk/html/cgi-bin/logproxy.cgi
Modified: ipcop/trunk/html/cgi-bin/logproxy.cgi
===================================================================
--- ipcop/trunk/html/cgi-bin/logproxy.cgi 2012-02-18 18:58:00 UTC (rev
6368)
+++ ipcop/trunk/html/cgi-bin/logproxy.cgi 2012-02-18 21:54:22 UTC (rev
6369)
@@ -16,7 +16,7 @@
# along with IPCop. If not, see <http://www.gnu.org/licenses/>.
#
# (c) The SmoothWall Team
-# Copyright (c) 2001-2011 The IPCop Team
+# Copyright (c) 2001-2012 The IPCop Team
#
# $Id$
#
@@ -41,6 +41,7 @@
my %cgiparams = ();
my %logsettings = ();
my %ips = ();
+my %users = ();
my %selected = ();
my %checked = ();
my @log = ();
@@ -55,6 +56,7 @@
$cgiparams{'DAY'} = $now[3];
$cgiparams{'MONTH'} = $now[4];
$cgiparams{'SOURCE_IP'} = 'ALL';
+$cgiparams{'USERNAME'} = 'ALL';
$cgiparams{'FILTER'} = "[.](gif|jpeg|jpg|png|css|js)\$";
$cgiparams{'ENABLE_FILTER'} = 'off';
$cgiparams{'ACTION'} = '';
@@ -74,6 +76,7 @@
if ($cgiparams{'ACTION'} eq $Lang::tr{'restore defaults'}) {
$cgiparams{'SOURCE_IP'} = 'ALL';
+ $cgiparams{'USERNAME'} = 'ALL';
$cgiparams{'FILTER'} = "[.](gif|jpeg|jpg|png|css|js)\$";
$cgiparams{'ENABLE_FILTER'} = 'on';
}
@@ -94,6 +97,7 @@
$cgiparams{'MONTH'} = $temp_then[1];
$cgiparams{'DAY'} = $temp_then[2];
$cgiparams{'SOURCE_IP'} = $temp_then[3];
+ $cgiparams{'USERNAME'} = $temp_then[4];
}
if (!($cgiparams{'MONTH'} =~ /^(0|1|2|3|4|5|6|7|8|9|10|11)$/)
@@ -129,6 +133,8 @@
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 = ();
@@ -186,6 +192,7 @@
READ: while (<FILE>) {
my ($datetime, $do, $ip, $ray, $me, $far, $url, $so) = split;
$ips{$ip}++;
+ $users{$so}++;
# for debug
#$lastdatetime = $datetime;
@@ -193,18 +200,19 @@
# 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
+ # when standard 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 +
$logsettings{'LOGVIEW_VIEWSIZE'})) {
- push(@log, "$datetime $ip $url");
+ push(@log, "$datetime $ip $so $url");
if (@log > $logsettings{'LOGVIEW_VIEWSIZE'}) {
shift(@log);
}
@@ -246,7 +254,8 @@
print "\n";
print "IPCop proxy log\r\n";
print "$Lang::tr{'date'}: $date\r\n";
- print "Source IP: $cgiparams{'SOURCE_IP'}\r\n";
+ print "$Lang::tr{'source ip'}: $cgiparams{'SOURCE_IP'}\r\n";
+ print "$Lang::tr{'username'}: $cgiparams{'USERNAME'}\r\n";
if ($cgiparams{'ENABLE_FILTER'} eq 'on') {
print "Ignore filter: $cgiparams{'FILTER'}\r\n";
}
@@ -256,23 +265,24 @@
#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'} = '';
@@ -338,31 +348,42 @@
<hr />
<table width='100%'>
<tr>
- <td width='25%' class='base'>$Lang::tr{'source ip'}:</td>
- <td>
- <select name='SOURCE_IP'>
- <option value='ALL' $selected{'SOURCE_IP'}{'ALL'}>$Lang::tr{'caps
all'}</option>
+ <td width='25%' class='base'>$Lang::tr{'source ip'}:</td>
+ <td width='25%' class='base'>
+ <select name='SOURCE_IP'>
+ <option value='ALL' $selected{'SOURCE_IP'}{'ALL'}>$Lang::tr{'caps
all'}</option>
END
- ;
+;
foreach my $ip (keys %ips) {
print "<option value='$ip' $selected{'SOURCE_IP'}{$ip}>$ip</option>\n";
}
print <<END
- </select>
- </td>
+ </select>
+ </td>
+ <td width='25%' class='base'>$Lang::tr{'username'}:</td>
+ <td width='25%' class='base'>
+ <select name='USERNAME'>
+ <option value='ALL' $selected{'USERNAME'}{'ALL'}>$Lang::tr{'caps
all'}</option>
+END
+;
+foreach my $so (sort keys %users) {
+ print "<option value='$so' $selected{'USERNAME'}{$so}>$so</option>\n";
+}
+print <<END
+ </select>
+ </td>
</tr>
<tr>
- <td class='base'>$Lang::tr{'enable ignore filter'}:</td>
- <td colspan='3'><input type='checkbox' name='ENABLE_FILTER' value='on'
$checked{'ENABLE_FILTER'}{'on'} /></td>
+ <td class='base'>$Lang::tr{'enable ignore filter'}:</td>
+ <td colspan='3'><input type='checkbox' name='ENABLE_FILTER' value='on'
$checked{'ENABLE_FILTER'}{'on'} /></td>
</tr>
<tr>
<td width='25%' class='base'>$Lang::tr{'ignore filter'}:</td>
<td><input type='text' name='FILTER' value='$cgiparams{'FILTER'}'
size='40' /></td>
- <td width='35%' align='center'>
+ <td colspan='2' align='center'>
<input type='submit' name='ACTION' value='$Lang::tr{'restore
defaults'}' />
<input type='submit' name='ACTION' value='$Lang::tr{'save'}' />
</td>
- <td width='5%' align='right'> </td>
</tr>
</table>
</form>
@@ -402,14 +423,15 @@
<tr>
<td width='10%' align='center' class='boldbase'><b>$Lang::tr{'time'}</b></td>
<td width='15%' align='center' class='boldbase'><b>$Lang::tr{'source
ip'}</b></td>
-<td width='75%' align='center'
class='boldbase'><b>$Lang::tr{'website'}</b></td>
+<td width='15%' align='center'
class='boldbase'><b>$Lang::tr{'username'}</b></td>
+<td width='60%' align='center'
class='boldbase'><b>$Lang::tr{'website'}</b></td>
</tr>
END
;
my $ll = 0;
foreach $_ (@log) {
print "<tr class='table".int(($ll % 2) + 1)."colour'>";
- 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);
@@ -427,12 +449,13 @@
$DAYdt = '';
}
print <<END
- <td align='center'>$DAYdt$HOURdt:$MINdt:$SECdt</td>
- <td align='center'>$ip</td>
- <td align='left'><a href='$url' title='$url'
target='_new'>$part</a></td>
+ <td align='center'>$DAYdt$HOURdt:$MINdt:$SECdt</td>
+ <td align='center'>$ip</td>
+ <td align='center'>$so</td>
+ <td align='left'><a href='$url' title='$url' target='_blank'>$part</a></td>
</tr>
END
- ;
+ ;
$ll++;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Ipcop-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ipcop-svn