You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
2.6 KiB
93 lines
2.6 KiB
4 months ago
|
#!/usr/bin/perl
|
||
|
#
|
||
|
# $Id: visitor.pl,v 1.5 2006/01/23 21:39:30 ddoughty Exp $
|
||
|
#
|
||
|
# Another test. Yes.
|
||
|
#
|
||
|
# Source File: visitor.pl
|
||
|
|
||
|
# Get config
|
||
|
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 = <VSTLOG>;
|
||
|
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 = <VSTLOG>;
|
||
|
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;
|
||
|
|
||
|
$SESSION{'browserapp'} = ($ENV{'HTTP_USER_AGENT'} =~ /MSIE/ ) ? "MSIE" : "NSNV";
|
||
|
&traceoutput("visitor.pl:$litmplt"); # TRACE IF ACTIVE
|
||
|
&show_template($litmplt);
|