#!/usr/local/bin/perl $dbfile= "realdb.dat"; ########## Win-NT チェック if( $ENV{"OS"} eq "Windows_NT" ){ $px = $ENV{"SCRIPT_NAME"}; $dx = substr( $px, 0, rindex( $px, "/" ) )."/"; $dbfile= "d:$dx$dbfile"; } ########## print <<"END_OF_HTML"; Content-type: text/html
会社ご案内





END_OF_HTML open( DB, $dbfile ) || die "データベースが開けませんでした。"; @data = ; close( DB ); $buffer = $ENV{'QUERY_STRING'}; if ($buffer eq "") { print "該当するデータが存在しません。"; } else { @pairs = split(/&/,$buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } $FORM{ "ID" } =~ s/[^0-9]//g; $match = "false"; foreach $dd ( @data ) { if( $match ne "true" ){ ( $id, $shop, $name, $no, $staff, $address, $tel, $fax, $open, $email, $url, $comment, $topics, $time, $rest ) = split( /\t/ , $dd ); # ($telchk, $dummy) = split( "/", $tel ); # $telchk =~ s/[^0-9]//g; if( $id eq $FORM{"ID" } ){ $match = "true"; break; } } } if( $match ne "true" ){ print "該当するデータが存在しません。"; } else { #################### # 略号を正式表記に変換 $shop =~ s/\(有\)/有限会社/; $shop =~ s/\(株\)/株式会社/; $shop =~ s/\(資\)/合資会社/; # 表示上のフォーマット変換 $no =~ s/^\(/福島県知事\(/; $no =~ s/\)-/\)第/; $no = $no."号"; if( $open ne "" ){ ( $oy, $om, $od ) = split( /\//, $open ); $open = $oy."年".$om."月"; } $comment =~ s/[\x0a\x0b\x0d\n]/
/g; $topics =~ s/[\x0a\x0b\x0d\n]/
/g; $time =~ s/[\x0a\x0b\x0d\n]/
/g; $rest =~ s/[\x0a\x0b\x0d\n]/
/g; #################### print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; if( $topics ne "" ){ print ''; print ''; print ''; } print ''; print ''; print ''; print ''; if( ($email ne "") && ($email =~ /^[^!]/ ) ){ print ''; print ''; print ''; } if( ($url ne "") && ($url =~ /^[^!]/ ) ){ print ''; print ''; print ''; } print "
社  名'.$shop.'免許番号'.$no.'
代表者名'.$name.'創  業'.$open.'
住  所'; print '';
		print $id.''.$address.'
TEL'.$tel.'FAX'.$fax.'
事業内容'.$comment.'
トピックス'.$topics.'
営業時間'.$time.'休  日'.$rest.'
E-Mail'.$email.'
ホームページ'.$url.'
\n"; print '
'; print ''; print ''; #################### } }