#!/usr/local/bin/perl
#^^^^^^^^これ^^^^^^^^をサーバーにあわせて書き直して下さい
##########################################################
#  Access Analysis "AshiatoLOG" Ver.1.01b                #
#                                                        #
#  Copyright (c) 2000,2001 Funakichi                     #
#  All rights reserved.                                  #
#  e-mail:   funabin@abox2.so-net.ne.jp                  #
#  homepage: http://www04.u-page.so-net.ne.jp/fa2/suga/  #
#                                                        #
##########################################################
# ATTENTION:This code is written with "S-JIS" character-set.

require "config.pl";
 require 'access.pl';

if ($ENV{'REQUEST_METHOD'} eq "POST")
{
	print "POST<BR>\n";
	return 0;
}
$buffer = $ENV{'QUERY_STRING'};
if (($cnt = index($buffer, 'ref='))>=0)
{
	$refer = substr($buffer, $cnt+4);
	$buffer = substr($buffer, 0, $cnt);
}
for (split(/&/,$buffer)){
	($name,$value) = split(/=/);
	$value =~ tr/+/ /;
	$value =~ s/%([\da-fA-F][\da-fA-F])/pack("C",hex($1))/eg;
	$value =~ s/\0//g;
	$DATA{$name} = $value;
}
$pageID = $DATA{'id'};
$gifimg = $DATA{'img'};
$scrCnd = $DATA{'scr'};

$acclog = new AshiatoFile($wrdir, $wrfile, $errfile, $lockfile, 300, 5, $maxlog, $intime, $updatetm);
$acclog->appendAccFile($pageID, $refer, $scrCnd);

if ($gifimg)
{
	@img = ( 71, 73, 70, 56, 57, 97,  1,  0,  1,  0,145,255,  0,255,255,255,
			  0,  0,  0,192,192,192,  0,  0,  0, 33,249,  4,  1,  0,  0,  2,
			  0, 44,  0,  0,  0,  0,  1,  0,  1,  0, 64,  2,  2, 84,  1,  0, 59	);

	print "Content-Type: image/gif\n\n";
	binmode(STDOUT);
	foreach $img (@img)
	{	$_ = pack('C1',  $img);
		print;
	}
}
else
{	print "<BR>\n";	}

