#!/usr/bin/perl $addr = $ENV{'REMOTE_ADDR'}; $ref = $ENV{'QUERY_STRING'}; ( $sec, $min, $hour, $day, $mon, $year, $wday ) = localtime( time ); $yyyymmdd = sprintf( "%04d%02d%02d", $year + 1900, $mon + 1, $day ); open(IP,"+<./ip.dat"); @iplines = ; if ( $iplines[0] != $addr ) { $iplines[0] = $addr; seek( IP,0,0 ); print IP @iplines; open(IN,">>./log/$yyyymmdd"); print IN "\n"; close(IN); if($ref){ open(REFIN,"./ref/ref.dat"); @refin=; close(REFIN); foreach (@refin){ split(/\<>/); if($_[0] eq $ref){$rf=1;$_[1]++;$newl=$_[0].'<>'.$_[1]."\n";push(@refnew,$newl);} else{push(@refnew,$_);} } print "Content-type:text/html\n\n"; print "test"; exit; if($rf){ open(REF,">./ref/ref.dat"); print REF @refnew; close(REF); }else{ $rfnew=$ref.'<>'.'1'."\n"; open(REF,">>./ref/ref.dat"); print REF $rfnew; close(REF); } } } close( IP ); open (IMG,"./spacer.gif"); binmode IMG; binmode STDOUT; print "Content-type: image/gif\n\n"; print ; close(IMG); exit;