#!/usr/local/bin/perl5 # $| = 1; $file = "./schedule.dat"; # リストファイル名 $last = 0; $num = 0; $num_old = 0; print "Content-type: text/html\n"; print "\n"; ( $sec, $min, $hour, $day, $mon, $year ) = localtime(time); $mon++; $year = ($year > 97 ? $year + 1900 : $year + 2000); $now_time=$year*372 + $mon*31 + $day -31; # 過去データの消去、並び変え open IN, "<$file"; while(){ chop; $list[$num]=$_; @box=split(/#/,$_); ( $b_year , $b_mon , $b_day ) = @box[0,1,2]; $time[$num]=$b_year*372 + $b_mon*31 + $b_day -31; if( $time[$num] > $now_time-30 ){ $num++; } else { $time[$num]=""; $list[$num]=""; } } close IN; for( $i=0 ; $i < $num-1 ; $i++){ if ($time[$i] > $time[$i+1]){ $dummy1 = $time[$i]; $dummy2 = $list[$i]; $time[$i] = $time[$i+1]; $list[$i] = $list[$i+1]; $time[$i+1] = $dummy1; $list[$i+1] = $dummy2; $i =($i > 0 ? $i - 2 : $i ); } }; open OUT, ">$file"; for( $i=0 ; $i < $num ; $i++ ){ print OUT "$list[$i]\n"; }; close OUT; # HTML 作成 open IN, "+<$file"; while(){ chop; @sche=split(/#/,$_); $month = @sche[1]; if ( @sche[1] == $last ){ @sche[1] = ""; } else { @sche[1] = "@sche[1]月"; $last = @sche[1]; }; $fontcolor = "000000"; $contcolor = @sche[7]; $todaycolor = "000000"; $date=join("",@sche[1],@sche[2],"日(",@sche[3],")"); if ( @sche[3] eq "日" || @sche[3] eq "祝" ) { $fontcolor = "FF0000"; } if ( @sche[3] eq "土" ) { $fontcolor = "0000FF"; } if ( @sche[0] == $year && $month == $mon && @sche[2] == $day ) { $bcolor = "FFEE99"; }else{ $bcolor ="FFFFFF"; } $data = <<"end_msg"; $data $date @sche[4] @sche[5] @sche[6] end_msg chop($data); } close IN; #本文 $text = <<"end_msg"; SCHEDULE

今後の日程

スケジュールの入力

一ヶ月以上前のスケデュールは自動的に消去されます $data
月日 内容 場所 時間



スケジュールの入力

数字は半角入力でお願いします。
スケジュールを書き込むにはパスワードが必要です。

曜日

内容 その他

場所 その他

パスワード

「削除」を選択すると、設定した日付の項を削除します

end_msg print $text;