%PDF- %PDF-
Direktori : /home/rappan/www/cgi_access/ |
Current File : /home/rappan/www/cgi_access/hana_page.cgi |
#!/usr/bin/perl #****************************************************************************** # # hana_page.cgi - Access Analyzer # #Version :2.17 #modified :2002/01/08 #Copyright :The Room #E-Mail :dream@lib.net #URL :http://dream.lib.net/room/ # #****************************************************************************** #1行目のperlのディレクトリ指定は、サーバによって異なります。 #詳しくは、管理者にお聞きください。 #****************************************************************************** require './hana_set.cgi'; require $lib_jcode; &read_setting; $cl = $ENV{"CONTENT_LENGTH"}; if( $cl > 0 ){ read(STDIN, $qs, $cl ); }else{ $qs = $ENV{"QUERY_STRING"}; } @contents = split(/&/,$qs,7); foreach $i (0 .. $#contents) { local($key,$text)= split(/=/,$contents[$i],2); $text =~ s/\+/ /g; $text =~ s/%(..)/pack("c",hex($1))/ge; $text =~ s/\r//g; $text =~ s/\n//g; $text =~ s/</</g; $text =~ s/>/>/g; $text =~ s/&/&/g; $text =~ s/"/"/g; $IN{$key}=$text; } &main; #***************************************************************************** sub main{ my ($file,$a1,$a2,$a3,@temp1,@temp2,@temp3); my $data_ret = 0; foreach(@set_data2){ @temp1 = split(/_/,$_,2); if ($temp1[0] eq $IN{'id'}){$file = $temp1[0];last;} } &error if $file eq '' || $IN{'id'} eq ''; &error if $IN{'type'} ne 'main' && $IN{'type'} ne 'today' && $IN{'type'} ne 'yest'; if ($IN{'type'} eq 'main'){ #訪問回数 for $a3 (split(/; */, $ENV{'HTTP_COOKIE'})) { ($a1,$a2) = split(/=/, $a3); if ($a1 eq 'aad_'.$IN{'id'}){ $last_visit = $a2; last; } } $data_ret=1 if ($last_visit eq "") || ($ct_double < 1) || ($last_visit + $ct_double*3600 < time()) } if($data_ret){ print "Set-Cookie:aad_$IN{'id'}=".time()."; expires=Thu, 1-Jan-2030 00:00:00 GMT;\n"; open(IO,"+<$dir_acs/$file.dat"); eval{flock(IO,2)}; @temp1 = split(/<>/,<IO>);pop(@temp1); @temp2 = split(/<>/,<IO>);pop(@temp2); @temp3 = split(/<>/,<IO>);pop(@temp3); $a1 = int((time()+$area_time)/86400)-int(($temp1[3]+$area_time)/86400); $a2 = int(time()/3600)-int($temp1[3]/3600); if ($a1 == 0){$temp1[1]++;} elsif ($a1 == 1){$temp1[2]=$temp1[1];$temp1[1]=1;} else{$temp1[1]=1;$temp1[2]=0;} $temp1[0]++; if ($a2 >= $set_data1[1]){@temp2 = ();} elsif($a2 >= 1){for(1..$a2){unshift(@temp2,0);}} $temp2[0]++; if ($a1 >= $set_data1[2]){@temp3 = ();} elsif($a1 >= 1){for(1..$a1){unshift(@temp3,0);}} $temp3[0]++; truncate(IO,0); seek(IO,0,0); print IO "$temp1[0]<>$temp1[1]<>$temp1[2]<>".time()."<>\n"; for(0..$set_data1[1]-1){print IO $temp2[$_]."<>";}print IO "\n"; for(0..$set_data1[2]-1){print IO $temp3[$_]."<>";}print IO "\n"; close(IO); }else{ open(IN,"$dir_acs/$file.dat"); eval{flock(IN,1)}; @temp1 = split(/<>/,<IN>); close(IN); } if($oth_ct_indi == 0){ print "Content-type:image/gif\n\n"; binmode(STDOUT); open(IN,$oth_ct_setimg); binmode(IN); while(<IN>){print;} close(IN); }else{ if ($IN{'type'} eq 'main'){$a1 = 0;} elsif ($IN{'type'} eq 'today'){$a1 = 1;} else{$a1 = 2;} @temp2=(); $oth_ct_fig[$a1]=0 if $oth_ct_fig[$a1] eq ''; $a2 = sprintf("%0".$oth_ct_fig[$a1]."d",$temp1[$a1]); foreach(split(//,sprintf("%0".$oth_ct_fig[$a1]."d",$a2))){ push(@temp2,$oth_ct_img[$a1]."/$_.gif"); } require $lib_gifcat; print "Content-type: image/gif\n\n"; binmode(STDOUT); print &gifcat::gifcat(@temp2); } } #***************************************************************************** sub error{ print "Content-type:image/gif\n\n"; binmode(STDOUT); open(IN,$ct_error); binmode(IN); while(<IN>){print;} close(IN); exit; } #*****************************************************************************