|
# *******************************************************************
# HTTP ヘッダ
# *******************************************************************
print "Expires: Thu, 04 Oct 2000 00:00:00 GMT\n";
print "Content-Type: text/html; Charset=shift_jis\n";
print "\n";
# *******************************************************************
# 環境変数を共通変数化
# *******************************************************************
$METHOD = $ENV{'REQUEST_METHOD'};
$METHOD =~ tr/a-z/A-Z/;
$QUERY_STRING = $ENV{'QUERY_STRING'};
# *******************************************************************
# ブラウザからの入力データの取得
# *******************************************************************
if ( $METHOD eq "POST" ) {
read(STDIN, $Form, $ENV{'CONTENT_LENGTH'});
@Fields_Data = split(/&/, $Form);
}
@Fields_Data2 = split(/&/, $QUERY_STRING);
foreach $Field_Data ( @Fields_Data ) {
($Name, $Value) = split(/=/, $Field_Data);
$Value =~ tr/+/ /;
$Value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$_POST{$Name} = $Value;
}
foreach $Field_Data2 ( @Fields_Data2 ) {
($Name, $Value) = split(/=/, $Field_Data2);
$Value =~ tr/+/ /;
$Value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$_POST{$Name} = $Value;
$_GET{$Name} = $Value;
}
# **********************************************************
# 引継ぎ用埋め込みデータの作成
# **********************************************************
sub CreateInData {
local($Key,$Value);
$InData = "";
while (($Key, $Value) = each(%_POST)) {
if ( substr( $Key, 0, 2 ) eq "In" ) {
if ( substr( $Key, 0, 3 ) ne "In2" ) {
$InData .= "<INPUT type=hidden name=$Key ";
$InData .= "value=\"$Value\">\n";
}
}
}
}
# **********************************************************
# 改行付表示関数
# **********************************************************
sub OutCr {
local($strValue) = $_[0];
print $strValue . "\n";
}
# **********************************************************
# デバッグ用情報表示関数
# **********************************************************
sub DispHash {
local(*Hash) = $_[0];
local($strTitle) = $_[1];
local($Option) = "bgcolor=white";
local($Key,$Value);
OutCr( "<TABLE border=0 bgcolor=black cellspacing=1>" );
OutCr( "<TH bgcolor=silver>$strTitle 名称</TH>" );
OutCr( "<TH bgcolor=silver>内容</TH>" );
while (($Key, $Value) = each(%Hash)) {
OutCr( "<TR>" );
OutCr( "<TD $Option>$Key</TD>" );
OutCr( "<TD $Option>$Value</TD>" );
OutCr( "</TR>" );
}
OutCr( "</TABLE>" );
}
1;
| |