Matthew Raymer
4 months ago
10072 changed files with 2702 additions and 2706 deletions
@ -1,96 +1,70 @@ |
|||||
#!/usr/bin/perl |
#!/usr/bin/perl |
||||
|
#use strict; |
||||
|
#use warnings; |
||||
|
use CGI; |
||||
|
use CGI::Carp qw(fatalsToBrowser); |
||||
|
|
||||
require 'sitecfg.pl'; |
require 'sitecfg.pl'; |
||||
require 'testlib.pl'; |
|
||||
|
|
||||
&traceoutput("visitor.pl:$ENV{'HTTP_REFERER'}"); # TRACE IF ACTIVE |
print "Content-type: text/plain\n\n"; |
||||
|
|
||||
&app_initialize; |
# Get user IDs |
||||
|
my $real_user_id = $<; |
||||
|
my $effective_user_id = $>; |
||||
|
|
||||
print "Content-Type: text/html\n\n"; |
# Get group IDs |
||||
|
my $real_group_id = $(; |
||||
|
my $effective_group_id = $); |
||||
|
|
||||
$mtime = time; |
# Get group names |
||||
$today = &format_date_time("yyyy-mm-dd hh:nn:ss GMT", "1", "-10000", $mtime); |
my $real_group_name = getgrgid($real_group_id); |
||||
|
my $effective_group_name = getgrgid($effective_group_id); |
||||
|
|
||||
$stdvisitorlog = join($pathsep, $secroot, "visitsstd.dat"); |
# Print user and group information |
||||
$clidvisitorlog = join($pathsep, $secroot, "visits$FORM{'clid'}.dat"); |
print "Real User ID: $real_user_id\n"; |
||||
$defaultvisitlog = join($pathsep, $secroot, "visits.dat"); |
print "Effective User ID: $effective_user_id\n"; |
||||
|
print "Real Group ID: $real_group_id ($real_group_name)\n"; |
||||
|
print "Effective Group ID: $effective_group_id ($effective_group_name)\n"; |
||||
|
|
||||
$msg = ""; |
my $cgi = CGI->new($ENV{'QUERY_STRING'}); |
||||
if (($FORM{'clid'} eq '') || ($FORM{'clid'} eq 'sacc') || ($FORM{'clid'} eq 'std')) { |
my %FORM = $cgi->Vars; |
||||
open(VSTLOG,"<$stdvisitorlog") or $msg="not found"; |
|
||||
if ($msg eq "not found") { |
my $session_id = $FORM{'tid'}; |
||||
$makeok = &make_file($stdvisitorlog, $defaultvisitlog, 1); |
|
||||
$msg = ($makeok == 1) ? "" : "failed"; |
my $s_id = "sess.$session_id"; |
||||
open(VSTLOG,"<$stdvisitorlog") or $msg="not found"; |
my $directory = join($pathsep, $logroot); |
||||
} |
my $trash = join($pathsep, $directory, $s_id); |
||||
if ($msg eq '') { |
|
||||
@visits = <VSTLOG>; |
if (-d $directory) { |
||||
close VSTLOG; |
print "Directory '$directory' exists.\n"; |
||||
} |
|
||||
$litmplt = "shome"; |
# Check if the directory is readable |
||||
|
if (-r $directory) { |
||||
|
print "Directory '$directory' is readable.\n"; |
||||
} else { |
} else { |
||||
open(VSTLOG,"<$clidvisitorlog") or $msg="not found"; |
print "Directory '$directory' is not readable.\n"; |
||||
if ($msg eq "not found") { |
|
||||
$makeok = &make_file($clidvisitorlog, $stdvisitorlog, 1); |
|
||||
$msg = ($makeok == 1) ? "" : "failed"; |
|
||||
open(VSTLOG,"<$clidvisitorlog") or $msg="not found"; |
|
||||
} |
|
||||
if ($msg eq '') { |
|
||||
@visits = <VSTLOG>; |
|
||||
close VSTLOG; |
|
||||
} |
|
||||
$litmplt = "cindex"; |
|
||||
$SESSION{'clid'} = $FORM{'clid'}; |
|
||||
&get_client_profile($FORM{'clid'}); |
|
||||
} |
} |
||||
|
|
||||
if ($FORM{'lang'} eq '') { |
# Check if the directory is writable |
||||
$lastvisit = -1; |
if (-w $directory) { |
||||
for (1 .. $#visits) { |
print "Directory '$directory' is writable.\n"; |
||||
@entries = split(/&/, $visits[$_]); |
|
||||
if ($entries[1] eq $ENV{'REMOTE_ADDR'}) { |
|
||||
$lastvisit = $_; |
|
||||
} |
|
||||
} |
|
||||
if ($lastvisit == -1) { |
|
||||
@languages=split(/\,/,$ENV{'HTTP_ACCEPT_LANGUAGE'}); |
|
||||
if ($languages[0] eq 'en') {$languages[0]="enu";} |
|
||||
if ($languages[0] eq 'en-us') {$languages[0]="enu";} |
|
||||
if ($languages[0] eq 'ar') {$languages[0]="arb";} |
|
||||
if ($LANGUAGE_ID{$languages[0]} ne '') { |
|
||||
$FORM{'lang'} = $languages[0]; |
|
||||
} |
|
||||
} else { |
} else { |
||||
@visitdata = split(/&/, $visits[$lastvisit]); |
print "Directory '$directory' is not writable.\n"; |
||||
$idx = $#visitdata - 1; |
|
||||
$FORM{'lang'} = $visitdata[$idx]; |
|
||||
@visitdata = (); |
|
||||
} |
} |
||||
|
} else { |
||||
|
print "Directory '$directory' does not exist.\n"; |
||||
} |
} |
||||
|
|
||||
@visits = (); |
# eval { |
||||
|
# open (my $SESSFILE, '>', $trash) or die "Could not open file '$trash': $!"; |
||||
&LanguageSupportInit(); |
# print $SESSFILE "This is a test.\n"; |
||||
|
# close($SESSFILE) or die "Could not close file '$trash': $!"; |
||||
|
# }; |
||||
|
|
||||
$visitrec = join('&',$today,$ENV{'REMOTE_ADDR'},$ENV{'REMOTE_PORT'},$ENV{'HTTP_ACCEPT_LANGUAGE'},$ENV{'HTTP_USER_AGENT'},$SESSION{'lang'},""); |
# if ($@) { |
||||
if (($FORM{'clid'} eq '') || ($FORM{'clid'} eq 'sacc') || ($FORM{'clid'} eq 'std')) { |
# print $@ |
||||
open(VSTLOG,">>$stdvisitorlog"); |
# } |
||||
} else { |
|
||||
open(VSTLOG,">>$clidvisitorlog"); |
|
||||
} |
|
||||
print VSTLOG "$visitrec\n"; |
|
||||
close VSTLOG; |
|
||||
print "$litmplt\n"; |
|
||||
print "--------------------------------------------------------------------------\n"; |
|
||||
$SESSION{'browserapp'} = ($ENV{'HTTP_USER_AGENT'} =~ /MSIE/ ) ? "MSIE" : "NSNV"; |
|
||||
&traceoutput("visitor.pl:$litmplt"); # TRACE IF ACTIVE |
|
||||
&show_template($litmplt); |
|
||||
print "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"; |
|
||||
|
|
||||
print "Content-type: text/html\n\n"; |
#while (my ($key, $value) = each %FORM) { |
||||
print "<html><body><h1>Test CGI Script</h1></body></html>\n\n"; |
# print "$key: $value\n"; |
||||
print "\n\n"; |
#} |
||||
print "$docroot\n"; |
|
||||
print "$secroot\n"; |
|
||||
print $resptmplt; |
|
||||
print "\n\n"; |
|
||||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue