#!/usr/bin/perl require 'sitecfg.pl'; require 'testlib.pl'; &traceoutput("visitor.pl:$ENV{'HTTP_REFERER'}"); # TRACE IF ACTIVE &app_initialize; print "Content-Type: text/html\n\n"; $mtime = time; $today = &format_date_time("yyyy-mm-dd hh:nn:ss GMT", "1", "-10000", $mtime); $stdvisitorlog = join($pathsep, $secroot, "visitsstd.dat"); $clidvisitorlog = join($pathsep, $secroot, "visits$FORM{'clid'}.dat"); $defaultvisitlog = join($pathsep, $secroot, "visits.dat"); $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 = ; close VSTLOG; } $litmplt = "shome"; } 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 = ; close VSTLOG; } $litmplt = "cindex"; $SESSION{'clid'} = $FORM{'clid'}; &get_client_profile($FORM{'clid'}); } 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]; } } else { @visitdata = split(/&/, $visits[$lastvisit]); $idx = $#visitdata - 1; $FORM{'lang'} = $visitdata[$idx]; @visitdata = (); } } @visits = (); &LanguageSupportInit(); $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"; print "Content-type: text/html\n\n"; print "

Test CGI Script

\n\n"; print "\n\n"; print "$docroot\n"; print "$secroot\n"; print $resptmplt; print "\n\n";