#!/usr/local/bin/perl
$p='1111';$d='./diary';@y='2006'..'2038';@m='01'..'12';@d='01'..'31';use CGI
':all';charset '';sub f{sprintf'%02d',shift}@t=localtime;@c=([y=>\@y,$t[5]+=1900],[m=>\@m,
f$t[4]+=1],[d=>\@d,f$t[3]]);if(chdir$d){*g=*param;for$l(@c){(${$l->[0]})=grep$_
eq g($l->[0]),@{$l->[1]};${$l->[0]}||=$l->[2]}if($p eq g('p')){($s=escapeHTML($s
=substr g('c'),0,8192))=~s/\r\n|\r|\n/<br>/g;if($s&&open F,">$y$m$d.html"){print
F eval'qq{'.join('',<DATA>).'}';close F}$f=textarea(-name=>'c',-cols=>60,-rows=>
10).br}if(open F,"$y$m$d.html"){read F,$h,-s F;close F}}put header,$h
,startform,$f,map(popup_menu(@$_),@c),br,password_field(-name=>'p'),br,submit,endform;
put 'パスワードは 1111' if $p eq '1111';
__DATA__
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>$y年$m月$d日の日記</title>
</head>
<body>
<dl>
<dt><font color="green"><b>$y年$m月$d日</b></font>
<dd>$s
</dl>
</body>
</html>