#!/usr/bin/perl #################################### # Setup begin $counterfile = "../counter/counter.txt"; #counter.txt的绝对路径 $imagefile{'0'}="../counter/0.gif"; # 0.gif的绝对路径 $imagefile{'1'}="../counter/1.gif"; # 1.gif的绝对路径 $imagefile{'2'}="../counter/2.gif"; # 2.gif的绝对路径 $imagefile{'3'}="../counter/3.gif"; # 3.gif的绝对路径 $imagefile{'4'}="../counter/4.gif"; # 4.gif的绝对路径 $imagefile{'5'}="../counter/5.gif"; # 5.gif的绝对路径 $imagefile{'6'}="../counter/6.gif"; # 6.gif的绝对路径 $imagefile{'7'}="../counter/7.gif"; # 7.gif的绝对路径 $imagefile{'8'}="../counter/8.gif"; # 8.gif的绝对路径 $imagefile{'9'}="../counter/9.gif"; # 9.gif的绝对路径 #Setup end ############################ $|=1; @querys = split(/&/, $ENV{'QUERY_STRING'}); foreach $query (@querys) { ($name, $value) = split(/=/, $query); $FORM{$name} = $value; } $position="$FORM{'position'}"; open(NUMBER,"$counterfile"); $number=; close(NUMBER); $number++; if ($position==1) { open(NUMBER,">$counterfile"); print NUMBER "$number"; close(NUMBER); } if (($position>0) && ($position<=length($number))) { $positionnumber=substr($number,(length($number)-$position),1); } else { $positionnumber="0"; } if ($imagefile{$positionnumber}) { $imagereturn=$imagefile{$positionnumber}; } else { $imagereturn=$imagefile{'0'}; } print "Content-type: image/gif\n\n"; open(IMAGE,"<$imagereturn"); print ; close(IMAGE); exit 0;