version 1.46, 2002/06/18 15:04:05
|
version 1.50, 2002/07/05 15:07:59
|
Line 195 sub logthis {
|
Line 195 sub logthis {
|
sub courselog { |
sub courselog { |
my ($path,$command)=@_; |
my ($path,$command)=@_; |
my %filters=(); |
my %filters=(); |
foreach (split(/\=/,&unescape($command))) { |
foreach (split(/\:/,&unescape($command))) { |
my ($name,$value)=split(/\=/,$_); |
my ($name,$value)=split(/\=/,$_); |
$filters{$name}=$value; |
$filters{$name}=$value; |
} |
} |
Line 204 sub courselog {
|
Line 204 sub courselog {
|
while ($line=<IN>) { |
while ($line=<IN>) { |
chomp($line); |
chomp($line); |
my ($timestamp,$host,$log)=split(/\:/,$line); |
my ($timestamp,$host,$log)=split(/\:/,$line); |
foreach (split(/\&/,&unescape($log))) { |
# |
my ($res,$uname,$udom,$action,$values)=split(/\:/,$_); |
# $log has the actual log entries; currently still escaped, and |
|
# %26(timestamp)%3a(url)%3a(user)%3a(domain) |
|
# then additionally |
|
# %3aPOST%3a(name)%3d(value)%3a(name)%3d(value) |
|
# or |
|
# %3aCSTORE%3a(name)%3d(value)%26(name)%3d(value) |
|
# |
|
# get delimiter between timestamped entries to be &&& |
|
$log=~s/\%26(\d+)\%3a/\&\&\&$1\%3a/g; |
|
# now go over all log entries |
|
foreach (split(/\&\&\&/,&unescape($log))) { |
|
my ($time,$res,$uname,$udom,$action,@values)=split(/\:/,$_); |
|
my $values=&unescape(join(':',@values)); |
|
$values=~s/\&/\:/g; |
|
$res=&unescape($res); |
my $include=1; |
my $include=1; |
} |
if (($filters{'username'}) && ($uname ne $filters{'username'})) |
|
{ $include=0; } |
|
if (($filters{'domain'}) && ($udom ne $filters{'domain'})) |
|
{ $include=0; } |
|
if (($filters{'url'}) && ($res!~/$filters{'url'}/)) |
|
{ $include=0; } |
|
if (($filters{'start'}) && ($time<$filters{'start'})) |
|
{ $include=0; } |
|
if (($filters{'end'}) && ($time>$filters{'end'})) |
|
{ $include=0; } |
|
if (($filters{'action'} eq 'view') && ($action)) |
|
{ $include=0; } |
|
if (($filters{'action'} eq 'submit') && ($action ne 'POST')) |
|
{ $include=0; } |
|
if (($filters{'action'} eq 'grade') && ($action ne 'CSTORE')) |
|
{ $include=0; } |
|
if ($include) { |
|
push(@results,($time<1000000000?'0':'').$time.':'.$res.':'. |
|
$uname.':'.$udom.':'. |
|
$action.':'.$values); |
|
} |
|
} |
} |
} |
close IN; |
close IN; |
return join('&',sort(@results)); |
return join('&',sort(@results)); |
Line 218 sub courselog {
|
Line 253 sub courselog {
|
sub userlog { |
sub userlog { |
my ($path,$command)=@_; |
my ($path,$command)=@_; |
my %filters=(); |
my %filters=(); |
foreach (split(/\=/,&unescape($command))) { |
foreach (split(/\:/,&unescape($command))) { |
my ($name,$value)=split(/\=/,$_); |
my ($name,$value)=split(/\=/,$_); |
$filters{$name}=$value; |
$filters{$name}=$value; |
} |
} |
Line 229 sub userlog {
|
Line 264 sub userlog {
|
my ($timestamp,$host,$log)=split(/\:/,$line); |
my ($timestamp,$host,$log)=split(/\:/,$line); |
$log=&unescape($log); |
$log=&unescape($log); |
my $include=1; |
my $include=1; |
|
if (($filters{'start'}) && ($timestamp<$filters{'start'})) |
|
{ $include=0; } |
|
if (($filters{'end'}) && ($timestamp>$filters{'end'})) |
|
{ $include=0; } |
if (($filters{'action'} eq 'log') && ($log!~/^Log/)) { $include=0; } |
if (($filters{'action'} eq 'log') && ($log!~/^Log/)) { $include=0; } |
|
if (($filters{'action'} eq 'check') && ($log!~/^Check/)) |
|
{ $include=0; } |
if ($include) { |
if ($include) { |
push(@results,$timestamp.':'.$log); |
push(@results,$timestamp.':'.$log); |
} |
} |
Line 337 sub make_new_child {
|
Line 378 sub make_new_child {
|
$queryid .= $run; |
$queryid .= $run; |
print $client "$queryid\n"; |
print $client "$queryid\n"; |
|
|
&logthis("QUERY: $query"); |
&logthis("QUERY: $query - $arg1 - $arg2 - $arg3"); |
sleep 1; |
sleep 1; |
|
|
my $result=''; |
my $result=''; |
Line 452 sub make_new_child {
|
Line 493 sub make_new_child {
|
# ------------------------------------------------------------ end of sql query |
# ------------------------------------------------------------ end of sql query |
} |
} |
|
|
# result does need to be escaped |
# result does not need to be escaped because it has already been |
|
# escaped. |
$result=&escape($result); |
#$result=&escape($result); |
|
|
# reply with result, append \n unless already there |
# reply with result, append \n unless already there |
|
|