200X/00/08 今日は、時間を表示させようと試みました(*^^*ゞ time関数とlocaltime関数で簡単にゲットできましたよ〜 赤い部分が時間所得のプログラム 緑が追加表示したぶぶん 《これを表示させるとこんな感じ→ 「dbbbs6.html」》 #!/usr/local/bin/perl print "Content-type: text/html\n\n"; read(STDIN, $naka, $ENV{"CONTENT_LENGTH"}); @nakami = split('&', $naka); foreach(@nakami) { ($hidari, $migi) = split("="); $migi =~ tr/+/ /; $migi =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("C", hex($1))/eg; $migi =~ s/<;/&lt;/g; $migi =~ s/>;/&gt;/g; 上2行は改行の制御部分ですが&が全角です。 $migi =~ s/\r?\n/<BR>/gi; $kaku{$hidari} = $migi; } ( $byou, $hun, $ji, $hi, $tuki, $toshi, $you ) = localtime( time ); $hyouji = sprintf( "%04d年%02d月%02d日",$toshi + 1900, $tuki + 1, $hi ); $youbi = sprintf( "(%s)", ( "日", "月", "火", "水", "木", "金", "土")[$you] ); $jikan = sprintf( "%02d時%02d分%02d秒", $ji, $hun, $byou ); $name = $kaku{'name'}; $memo = $kaku{'memo'}; $logfile = "../logfile.txt"; $dasufile = "../dbbbs2.html"; print <<MAMA; <META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://127.0.0.1/~****/****.html"> <BODY> ただ今書き込み中<p> MAMA open(LOGFILE, "+<$logfile"); @logs = <LOGFILE>; $ban = $logs[0] +1; $memo =~ s/\r?\n/<BR>/g; $logdata = $ban."<table><tr><td><b>$name</b>[ $hyouji$youbi$jikan]</td></tr><td>$memo</td></tr></table><hr>"."\n"; unshift( @logs, $logdata ); seek( LOGFILE, 0, 0 ); print LOGFILE @logs; truncate( LOGFILE, tell( LOGFILE )); close( LOGFILE ); open(DASU, ">$dasufile"); select DASU; print <<MAMA; <HTML> <HEAD><TITLE>TESTBBS</TITLE></HEAD> <BODY LINK="#000000" VLINK="#000000"> <FORM METHOD="POST" ACTION="cgi-bin/****.cgi"> name<INPUT NAME="name"><P> message<TEXTAREA NAME="memo" ROWS="4" COLS="60"> </TEXTAREA><P> <INPUT TYPE="submit" VALUE="submit"> <INPUT TYPE="reset" VALUE="reset"> <HR> MAMA print $logs[0]; print $logs[1]; print $logs[2]; print "</form>"; print "</html>"; close(DASU); exit; |