#!/usr/bin/perl
# your httpd.conf should have something like this:
# Alias /perl/ /real/path/to/perl-scripts/
#
# SetHandler perl-script
# PerlHandler Apache::Registry
# PerlSendHeader On
# Options +ExecCGI
#
if (($ENV{REMOTE_ADDR} ne "192.168.10.2") && ($ENV{REMOTE_ADDR} ne $ENV{SERVER_ADDR}))
{
open(LOG,">>/var/www/cybermage.net/report.txt");
print LOG $ENV{REMOTE_ADDR}."\|";
print LOG $ENV{HTTP_USER_AGENT}."\|";
print LOG $ENV{HTTP_ACCEPT_LANGUAGE}."\|";
print LOG $ENV{HTTP_REFERER}."\|";
print LOG $ENV{REQUEST_URI}."\|";
print LOG $ENV{HTTP_X_FORWARDED_FOR}."\|";
print LOG $ENV{HTTP_VIA}."\|";
print LOG localtime(time)."\|\n";
close(LOG);
$count = `cat /var/www/cybermage.net/counter.txt`;
chop($count);
$count = $count + 1;
open(CNT,">/var/www/cybermage.net/counter.txt");
print CNT "$count\n";
close(CNT);
}
else
{
open(LOG,">/var/www/cybermage.net/debug.txt");
print LOG "$ARGV[0]\n";
foreach $key (keys %ENV)
{
print LOG "$key=$ENV{$key}\n";
}
close(LOG);
}
print "Content-type: text/html\n\n";
my $path = "/var/www/cybermage.net/default.css";
if (index(lc($ENV{HTTP_USER_AGENT}),"msie") != -1)
{
$path = "/var/www/cybermage.net/defaultmsie.css";
}
if (index(lc($ENV{HTTP_USER_AGENT}),"windows ce") != -1)
{
$path = "/var/www/cybermage.net/defaultppc.css";
}
if (index(lc($ENV{HTTP_USER_AGENT}),"netfront") != -1)
{
$path = "/var/www/cybermage.net/defaultppc.css";
}
open(HTM,$path);
print ;
close(HTM);