Matthew Raymer
4 months ago
10072 changed files with 2702 additions and 2706 deletions
@ -1,96 +1,70 @@ |
|||
#!/usr/bin/perl |
|||
#use strict; |
|||
#use warnings; |
|||
use CGI; |
|||
use CGI::Carp qw(fatalsToBrowser); |
|||
|
|||
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; |
|||
$today = &format_date_time("yyyy-mm-dd hh:nn:ss GMT", "1", "-10000", $mtime); |
|||
# Get group names |
|||
my $real_group_name = getgrgid($real_group_id); |
|||
my $effective_group_name = getgrgid($effective_group_id); |
|||
|
|||
$stdvisitorlog = join($pathsep, $secroot, "visitsstd.dat"); |
|||
$clidvisitorlog = join($pathsep, $secroot, "visits$FORM{'clid'}.dat"); |
|||
$defaultvisitlog = join($pathsep, $secroot, "visits.dat"); |
|||
# Print user and group information |
|||
print "Real User ID: $real_user_id\n"; |
|||
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 = ""; |
|||
if (($FORM{'clid'} eq '') || ($FORM{'clid'} eq 'sacc') || ($FORM{'clid'} eq 'std')) { |
|||
open(VSTLOG,"<$stdvisitorlog") or $msg="not found"; |
|||
if ($msg eq "not found") { |
|||
$makeok = &make_file($stdvisitorlog, $defaultvisitlog, 1); |
|||
$msg = ($makeok == 1) ? "" : "failed"; |
|||
open(VSTLOG,"<$stdvisitorlog") or $msg="not found"; |
|||
} |
|||
if ($msg eq '') { |
|||
@visits = <VSTLOG>; |
|||
close VSTLOG; |
|||
} |
|||
$litmplt = "shome"; |
|||
my $cgi = CGI->new($ENV{'QUERY_STRING'}); |
|||
my %FORM = $cgi->Vars; |
|||
|
|||
my $session_id = $FORM{'tid'}; |
|||
|
|||
my $s_id = "sess.$session_id"; |
|||
my $directory = join($pathsep, $logroot); |
|||
my $trash = join($pathsep, $directory, $s_id); |
|||
|
|||
if (-d $directory) { |
|||
print "Directory '$directory' exists.\n"; |
|||
|
|||
# Check if the directory is readable |
|||
if (-r $directory) { |
|||
print "Directory '$directory' is readable.\n"; |
|||
} else { |
|||
open(VSTLOG,"<$clidvisitorlog") or $msg="not found"; |
|||
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'}); |
|||
print "Directory '$directory' is not readable.\n"; |
|||
} |
|||
|
|||
if ($FORM{'lang'} eq '') { |
|||
$lastvisit = -1; |
|||
for (1 .. $#visits) { |
|||
@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]; |
|||
} |
|||
# Check if the directory is writable |
|||
if (-w $directory) { |
|||
print "Directory '$directory' is writable.\n"; |
|||
} else { |
|||
@visitdata = split(/&/, $visits[$lastvisit]); |
|||
$idx = $#visitdata - 1; |
|||
$FORM{'lang'} = $visitdata[$idx]; |
|||
@visitdata = (); |
|||
print "Directory '$directory' is not writable.\n"; |
|||
} |
|||
} else { |
|||
print "Directory '$directory' does not exist.\n"; |
|||
} |
|||
|
|||
@visits = (); |
|||
|
|||
&LanguageSupportInit(); |
|||
# eval { |
|||
# open (my $SESSFILE, '>', $trash) or die "Could not open file '$trash': $!"; |
|||
# 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 (($FORM{'clid'} eq '') || ($FORM{'clid'} eq 'sacc') || ($FORM{'clid'} eq 'std')) { |
|||
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"; |
|||
# if ($@) { |
|||
# print $@ |
|||
# } |
|||
|
|||
print "Content-type: text/html\n\n"; |
|||
print "<html><body><h1>Test CGI Script</h1></body></html>\n\n"; |
|||
print "\n\n"; |
|||
print "$docroot\n"; |
|||
print "$secroot\n"; |
|||
print $resptmplt; |
|||
print "\n\n"; |
|||
#while (my ($key, $value) = each %FORM) { |
|||
# print "$key: $value\n"; |
|||
#} |
|||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue