#!/usr/local/bin/perl # _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ # # _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ # _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #initialize $dat = './path.dat'; $tmp = './temp.dat'; $log_file = './log.dat'; # _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ # TIME $time = time; $ENV{'TZ'} = "JST-9"; #TIMEZONE ($sec, $min, $hour, $mday, $mon, $year) = localtime(time()); $date_now = sprintf("%04d/%02d/%02d", 1900 + $year, $mon + 1, $mday); $time_now = sprintf("%02d:%02d:%02d", $hour, $min, $sec); $ld = $ENV{'QUERY_STRING'}; $ip = $ENV{'REMOTE_ADDR'}; $referer = $ENV{'HTTP_REFERER'}; $referer =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("C", hex($1))/eg; $reffile =~ s/\\//g; $agent = $ENV{'HTTP_USER_AGENT'}; # _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ # rand open (DAT,"$dat"); @dats = ; close (DAT); $i = @dats; srand; $to = int (rand("$i")); $idat = $dats[$to]; chomp $idat; #allow if($ld eq 'link'){ # LINK open (TMP,"$tmp"); @tmp = ; close (TMP); foreach $temp(@tmp){ ($ttime,$tip,$turl) = split(/\=\=\=/,$temp); if($tip eq $ip){ last; } $ttime = $tip = $turl = ''; } if($turl ne ''){ chomp $turl; print "Location: $turl\n\n"; open(OUT,">> $log_file"); print(OUT "$agent\n"); close(OUT); exit 0; } else{ print "Location: $ENV{'HTTP_REFERER'}\n\n"; } } else{ # GIF if($idat =~ /\s\=\s/){ ($id,$ud) = split(/\s\=\s/,$idat); } else{ $id = chomp $idat; } if($ld ne 'img'){ open (TMP,"$tmp"); @tmp = ; close (TMP); $ci = 0; foreach $temp(@tmp){ ($ttime,$tip,$turl) = split(/\=\=\=/,$temp); if($tip ne $ip){ if($ttime >= ($time - 60*60)){ push (@ndat,$temp); } } } $nd = "$time".'==='."$ip".'==='."$ud"."\n"; unshift (@ndat,$nd); open (TMP,">$tmp"); print TMP @ndat; close (TMP); } open (IMG,"$id"); binmode(IMG); print "Content-type: image/gif\n\n"; binmode(STDOUT); while(){ print; } close(IMG); } exit 0;