#!/usr/bin/perl # count.pl is freeware: (c)GOMASUKE $base = 'http://www.hogehoge.(or|ne).jp/~foo/'; $fly = './fly'; $img = './gif'; $dgx = 15; $dgy = 20; $dat = $ENV{'QUERY_STRING'}; @buf = split('&',$dat); foreach $item (@buf) { ($var,$value) = split('=',$item); $itm{$var} = $value; } $width = $itm{'width'}; $increment = $itm{'increment'}; $link = $itm{'link'}; if ($increment eq "") { $increment = 1; } $file = "$link\.txt"; $ref = $ENV{'HTTP_REFERER'}; $ref =~ s/%7E/~/gi; if (-e $file && $ref =~ /^$base/) { open(IN,"+<$file"); flock(IN,2); $cnt = ; $cnt += $increment; seek(IN,0,0); print IN "$cnt\n"; close(IN); } else { $infile = "$img\/warn.gif"; print "Content-type: image/gif\n\n"; open(GF,"<$infile"); print (); close(GF); exit; } if ($width =~ /\D/ || $width == 0) { $width = length($cnt); } $w = $width * (-1); $z = '0' x $width; $cnt = substr("$z$cnt",$w); $img_x = $width * $dgx; $infile = "fly.$$"; open(FLY,">$infile"); print FLY "new\n"; print FLY "size $img_x,$dgy\n"; $i = 0; for ($x = 0; $x < $img_x; $x += $dgx) { $dg = substr($cnt,$i,1); print FLY "copy $x,0,-1,-1,-1,-1,$img\/$dg\.gif\n"; $i++; } close(FLY); print "Content-type: image/gif\n\n"; open(GF,"$fly -q -i $infile |"); print (); close(GF); unlink($infile); exit;