#!/usr/bin/perl #アクセスカウンタを格納するファイル #$count_file = "/home5/user/count/WWW/mhp.txt"; $count_file = "/home/httpd/cgi-bin/mhp/mhp.txt"; # カウンタ数を読み込んで変数に代入 open(DATA,"<$count_file") || &error(2); $count = ; close(DATA) || &error(2); # アクセスカウント処理 $count++; open(OT,">$count_file") || &error(3); print OT "$count"; close(OT) || &error(3); #引数の取り出し(汎用) $query_env = $ENV{'QUERY_STRING'}; @query_datas = split(/&/,$query_env); $x = 0 ; ($pg_name) = $ENV{SCRIPT_NAME} =~ m|/([^/]+)$| ; foreach $val(@query_datas){ $val =~ s/\+/ /g; $val =~ s/%([0-9A-F][0-9A-F])/pack("c",hex($1))/gie; $val =~ s/\r\n?/\n/g; ($query_name, $query_value) = split(/=/, $val); $query_value =~ tr/+/ /; # 連想配列 inparaに代入 $inpara{$query_name} = $query_value; $x++ ; } #$filename = $inpara{"filename"} ; $pg_name =~ s/.png//g ; $filename = $pg_name ; #EZwebのカラー液晶携帯か白黒液晶携帯かを判別 $ez_color = $ENV {'HTTP_X_UP_DEVCAP_ISCOLOR'}; #アクセスしてくる種類を判断 $jphone=0;$imode=0;$ezweb=0; $WKENV=$ENV{'HTTP_USER_AGENT'}; if($WKENV =~ /DoCoMo/){$imode=1;} $WKENV=$ENV{'HTTP_USER_AGENT'}; if($WKENV =~ /UP\.Browser/){$ezweb=1;} $WKENV=$ENV{'HTTP_X_JPHONE_MSNAME'}; if($WKENV ne ""){$jphone=1;} if($jphone==1 && $imode==0 && $ezweb==0) { #J-Phone print "Content-type: text/html\n\n"; print("\n"); $filename = "j/top.html" ; } elsif($jphone==0 && $imode==1 && $ezweb==0) { #imode print "Content-type: text/html\n\n"; print("\n"); $filename = "i/top.html" ; } elsif($jphone==0 && $imode==0 && $ezweb==1) { #ezweb print "Content-type: text/html\n\n"; print("\n"); if($ez_color==1) { $filename = "ez-c/top.html" ; } else { $filename = "ez-wb/top.html" ; } } else { print "Content-type: text/html\n\n"; print("\n"); $filename = "i/top.html" ; } open(IMG,"./$filename"); binmode(IMG); binmode(STDOUT); print ; close(IMG);