#!/usr/bin/env perl print "Content-Type: text/html; charset=Shift_JIS\n\n"; &decode; print "\n"; $sports = $tags{'sports'}; $s_id = $tags{'student_id'}; $name = $tags{'name'}; if ($s_id eq "") { $s_id = "未記入"; } if ($name eq "") { $name = "名無し"; } print "学籍番号", $s_id, "の", $name, "さんは、"; if ($sports) { @sports_a = ("野球", "サッカー", "バスケットボール", "テニス", "ゴルフ"); print $sports_a[$sports-1]; print "が一番お好きなのですね。\n"; } else { print "一番お好きなスポーツを答えていただいておりません(;_;)\n"; } print "\n"; #------------------------------------------------------------ # cgi.pl - decode CGI input. # by ETO Kouichirou # date 1994/05/11 # # Usage: # # &decode; # ... # $name = $tags{'name'}; sub decode { local($args, $n_read, *terms, $tag, $value); if ($ENV{'REQUEST_METHOD'} eq "POST"){ $n_read = sysread(STDIN, $args, $ENV{'CONTENT_LENGTH'}); } else { $args = $ENV{'QUERY_STRING'}; } @terms = split('&', $args); foreach (@terms) { ($tag, $value) = split(/=/, $_, 2); $otags{$tag} = $value; # original tags $tags{$tag} = &unpack($value); # tags is global } } sub unpack { local($value) = @_; $value =~ s/\+/ /g; $value =~ s/%(..)/pack("c", hex($1))/ge; return $value; } sub unspecial { local($value) = @_; $value =~ s/&/&/g; $value =~ s//>/g; return $value; }