%PDF- %PDF-
Direktori : /home/rappan/www/cgi_access/ |
Current File : /home/rappan/www/cgi_access/hana_ct.cgi |
#!/usr/bin/perl #****************************************************************************** # # hana_ct.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; $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 ($a1,$a2,@temp1,@temp2); if ($IN{'type'} eq 'today'){$a1 = 1;} elsif ($IN{'type'} eq 'yest'){$a1 = 2;} else{&error;} open(IN,"$dir_acs/top.dat"); eval{flock(IN,1)}; @temp1 = split(/<>/,<IN>); close(IN); if($top_ct_indi == 0){ print "Content-type:image/gif\n\n"; binmode(STDOUT); open(IN,$top_ct_setimg); binmode(IN); while(<IN>){print;} close(IN); }else{ @temp2=(); $top_ct_fig[$a1]=0 if $top_ct_fig[$a1] eq ''; $a2 = sprintf("%0".$top_ct_fig[$a1]."d",$temp1[$a1]); foreach(split(//,sprintf("%0".$top_ct_fig[$a1]."d",$a2))){ push(@temp2,$top_ct_img[$a1]."/$_.gif"); } require $lib_gifcat; print "Content-type: image/gif\n\n"; binmode(STDOUT); print &gifcat::gifcat(@temp2); } exit; } #***************************************************************************** sub error{ print "Content-type:image/gif\n\n"; binmode(STDOUT); open(IN,$ct_error); binmode(IN); while(<IN>){print;} close(IN); exit; } #*****************************************************************************