#!/usr/local/bin/perl #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #+++  [ tackynote Ver0.98 ] 2000.12.16 UPDATE!! #+++ #+++ ・・・・・>>> All Created by Tacky #+++ #+++ ・・・・・>>> Copyright (c) 1999.5 Tacky's Room. All rights reserved.... #+++ #+++ Email >>> tacky2@ops.dti.ne.jp #+++ Homepage >>> http://tackysroom.com/ #+++ #+++ 設置方法構成(具体例) #+++ public_html(ホームページディレクトリ) #+++ |-- cgi-bin(任意のディレクトリ) #+++ |-- jcode.pl (755)…(日本語ライブラリ) #+++ |-- tackynote.cgi (755)…(スクリプト本体) #+++ |-- tackynote.txt (666)…(ログファイル) #+++ ■( )内はパーミッッションの値です。 #+++ ■tackynote.cgi :Perlのパス、その他の項目を修正、テキストモードでアップロード。 #+++ ■tackynote.txt :空のテキストファイルを作成(ダウンロードファイルに添付済)し、テキストモードでアップロード #+++ #+++ >>> Update-History... #+++ #+++ 2000.12.16(Ver0.98) >> 余りにも要望が強かった『過去ログ作成』機能を追加 #+++ >> パスワードをクッキー対応にしました。今まで毎回入力させてすんましぇん(^^ゞ #+++ >> カレンダーを表示しない場合のアイコン一覧表示方法に矛盾(文章に)があったのを直しました。 #+++ 2000.11.14(Ver0.971) >> 入力フォームにおいてアイコンのSELECTED指定に漏れ。・アイコンの1番目を選択しても日記帳部分にアイコン表示さなかった。(^^ゞ #+++ 2000.11.11(Ver0.97) >> 日記帳のログをダウンロード出来るようにしました。電話代節約してねん。(^-^) #+++ 日記部分にアイコンを表示出来るようにしました。カレンダー部分のアイコンと、別のアイコンも設定出来ます。 #+++ 管理者専用の日記表示パターンとして、カレンダーを表示せず、表示対象月の日記のみ表示出来る機能を追加 #+++ ※$kiero(←なんと単純な名前だ・・・)という変数を設定する箇所を見てね。 #+++ 2000.07.12 >> ファイルロックが解除されない場合がある不具合修正 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ###require './jcode.pl'; #日本語コード変換 require 'd:/InetPub/wwwroot/tackysroom/tackynote/jcode.pl'; #日本語コード変換 ###$url = "http://tackysroom.com/"; #戻り先URL $url = "/tackysroom/"; #戻り先URL $script = "./tackynote.cgi"; #このCGIの名前を指定 ###$logfile = "./tackynote.txt"; #ログファイル名を指定 http://〜では指定出来ません $logfile = "d:/InetPub/wwwroot/tackysroom/tackynote/tackynote.txt"; #ログファイル名を指定 http://〜では指定出来ません ###$lockfile = "./tackynote.lock"; #ロックファイル名を指定(変更不要) $lockfile = "d:/InetPub/wwwroot/tackysroom/tackynote/tackynote.lock"; #ロックファイル名を指定(変更不要) $method = 'POST'; #METHODの指定(POST又はGET) $titlename = 'あたいのにっきちょ♪'; #タイトルを指定 ###$titlelogo = './tackynote.gif'; #タイトル画像を指定 $titlelogo = ''; #タイトル画像を指定 $bgcolor = '#FF9900'; #背景色を指定 $backpicture = ''; #背景画像を指定(使用しない場合は、''で良い) $tbgcolor = '#FFFFCC'; #入力フォームの背景色を指定 $ftextcolor = '#333333'; #入力フォームの文字色を指定 $ftextcolor2 = '#000000'; #レスフォームの文字色を指定 $ftextcolor3 = '#990000'; #日記表示部分のタイトルの文字色を指定 $calcolor = '#FFFFCC'; #カレンダー部分のセル背景色を指定 $calbordercolor = '#99CCCC' ; #カレンダー部分の枠線の色を指定 $msg_cellbgcolor = '#FFFFFF'; #メッセージ部分のセル背景色を指定 $msg_bordercolor = '#99CCCC' ; #メッセージ部分の枠線の色を指定 $datamax = 100 ; #最大データ保存件数(レス(返信)件数は除く) ###$oldfile = './tackynote_old.txt'; #過去ログファイルを指定。 http://〜では指定出来ません $oldfile = 'd:/InetPub/wwwroot/tackysroom/tackynote/tackynote_old.txt'; #過去ログファイルを指定。 http://〜では指定出来ません #※最大件数を超えると、過去ログファイルへ古いデータから移動していきます #※過去ログファイルを指定していない場合($oldfile='';)は、古いデータから1件ずつ削除していきます。 ###$password = '_hoge_hoge_'; #メンテナンス用パスワード(管理者用) $password = '1234'; #メンテナンス用パスワード(管理者用) #<<<祝日の設定 @holiday = ('0101','0211','0322','0429','0503','0504','0505','0720','0915','0923','1103','1123','1223'); #◆<<< 指定年月のログを、一度に1ヶ月分表示させるか?(yes,no)。 #◆<<< noの場合は一日ずつ表示(一日毎にクリックするとログを表示するパターン) $monthview = 'yes'; #◆<<< 上記の$monthviewが'yes'の場合、 #◆<<< ログを昇順(上から1〜31日)に表示するなら'1',降順(上から31〜1日)の場合'2' $viewsort = 2; #◆<<< カレンダー部分(ひとマス)のheight,width(四角形なので、設定値も1個だけね) $calsize = 30 ; #Pixel #◆<<< ↓お好きなようにどうぞ。例: ('Sun','Mon','Tue','Wed','Thu','Fri','Sat') @week = ('日','月','火','水','木','金','土'); $col = 70 ; #日記を書く欄の横桁数(80だと日本語で40文字です) $row = 15 ; #日記を書く欄の行数 #========================================================================================== #>>>カレンダー部分に『日記を書いた日』である事を認識させる設定 #========================================================================================== # $icon_gif[0]が設定されている場合は、$icon_gif[n]を優先的に表示させます。 # $icon_gif[0]が設定されていない場合(削除してもいいけど)は # $img_gifが設定されていれば$img_gifの画像を表示、未設定の場合は■を表示します。 #1個のアイコンだけを使用する場合 ###$img_gif = './saru.gif'; #"メモを書いた日"に表示する画像を指定。(指定しないと■が表示されます) #複数のアイコンを使用する場合。たくさん設定した場合、$icon[4]...$icon[9]のようにただ増やしていけばいいです。 ###$icon[0]='./man01-03.gif' ; $iconnm[0]='嬉しかった日'; ###$icon[1]='./man01-04.gif' ; $iconnm[1]='怒った日'; ###$icon[2]='./man01-06.gif' ; $iconnm[2]='悲しかった日'; ###$icon[3]='./man01-07.gif' ; $iconnm[3]='眠かった日'; $icon_w = 25; #アイコン横サイズ(全アイコンが同じサイズの場合。異なる場合は0にしてね) $icon_h = 27; #アイコン縦サイズ(全アイコンが同じサイズの場合。異なる場合は0にしてね) $disp_icon = 0 ; #日記を表示した際に日記の横にアイコンも表示する?(0:no 1:yes) i001109 #================================================================================================================== #>>>日記表示部に表示するアイコンの設定 $disp_icon = 1(yes)の設定の場合のみ有効。noの場合は無視していいです。 #================================================================================================================== $onaji = 0 ; #カレンダーに表示するアイコンと同じアイコンを使う?(0:no 1:yes) #アイコン・アイコン名称・アイコンの幅・アイコンの高さ。 幅と高さがわからない場合は、$icon2_w[0]=0;のように0を指定してね。 #アイコンを追加する場合は、$icon2[4]...$icon2[9]のようにただ増やしていけばいいです。 $icon2[0] = './ball.gif' ; $iconnm2[0] = '気分はボール' ; $icon2_w[0] = 32 ; $icon2_h[0] = 32 ; $icon2[1] = './corgi.gif' ; $iconnm2[1] = '気分はコーギー' ; $icon2_w[1] = 32 ; $icon2_h[1] = 32 ; $icon2[2] = './cow.gif' ; $iconnm2[2] = '気分はうし' ; $icon2_w[2] = 32 ; $icon2_h[2] = 32 ; $icon2[3] = './denchi.gif' ; $iconnm2[3] = '気分は電池' ; $icon2_w[3] = 32 ; $icon2_h[3] = 32 ; $tcolor = "#FFFFFF"; # 文字色 $linkcolor = "#FFFF00"; # リンク色(未読リンク) $vlinkcolor = "#FFCC66"; # リンク色(既読リンク) $alinkcolor = "#666600"; # リンク色(押した時) $hovercolor = '#ff0000'; #リンクをポイントした際のアンダーライン色(IEのみ) u000301 $pt = '10pt'; #全体のフォントサイズ(pt指定以外何があるのか、僕知らない。(^^ゞ) $back_gif = './b_102.gif'; #「1ヶ月戻る」用画像(使用しない場合は'') $next_gif = './b_103.gif'; #「1ヶ月進む」用画像(使用しない場合は'') $setyear_b = 2; #カレンダーを年月指定で移動する場合、「年」は過去何年まで表示します?(1の場合、前年まで表示) $setyear_a = 1; #カレンダーを年月指定で移動する場合、「年」は未来何年まで表示します?(5の場合、5年先まで表示) $tbl_sz = '80%' ; #日記表示部のテーブル横幅(ピクセル又は%) $color_nml = '#000000'; #カレンダー・「平日」の文字色 $color_sat = '#0000ff'; #カレンダー・「土曜日」の文字色 $color_sun = '#ff0000'; #カレンダー・「日曜日」の文字色 $color_hol = '#ff0000'; #カレンダー・「祝日」の文字色 $color_today = '#ffcc00'; #カレンダー・「今日」の背景色 $resflg = 1 ; #レス機能を使用する?(0:しない 1:する) #投稿時のパスワードをcrypt関数を使用する(暗号化) #crypt関数が利用出来ない場合もありますので、投稿時にエラーになる場合は、「0:使用しない」にして下さいね。 $ango = 1 ; #0:使用しない 1:使用する (推奨:1:使用する) #色の指定(1行レス投稿時の文字色)。色を増やしたい場合は、'#336699','#003366'のようにどんどん増やしていいですよ。 @COLORS = ('#000000','#99cc33','#ff9900','#99cccc','#ff6666','#666666','#999900','#ff9999','#cc99cc','#990000'); @COLORSNM = ('Black','Green','Orange','Blue','Red','Gray','Gold','Pink','Purple','Brown'); #1行レス投稿フォームでの返信ボタンに表示する文字 $resword = '感想'; $titleflg = 1 ; #日記に「タイトル」が必要?(0:不要 1:必要) #掲示板荒らし対策。排除したいプロバのアドレスを設定して下さい。 # "xxx?.com"とした場合、"xxx1.com","xxx2.com"等、「?」の部分が文字列1つと判断します # "xxx*.com"とした場合、"xxx1.com","xxx12345.com等、「*」の部分が0個以上の文字列と判断します。 @DANGER_LIST=("xxx.com","yyy.com","zzz*.or.jp"); #掲示板荒らし対策その2。メッセージ最大文字数を指定。特に設定しない場合は、''として下さい。3000は全角1500文字です。 $maxword = '3000' ; #レス投稿フォームのコメント入力欄は「1行テキスト」?「複数行テキスト」? $res_text = 0 ; #0:1行テキスト 1:複数行テキスト(テキストエリア) $sz = 50 ; #1行レス場合、1行の文字数は? $c_sz = 50 ; #複数行テキストの場合、1行の文字数 $r_sz = 3 ; #複数行テキストの場合、行数 $minnade = 0; #管理人以外も日記を書けるようにする?(0:しない 1:する) $zurazura = 1 ; #1日に複数回(人)日記を書いた場合、アイコンを1個しか表示しないようにする?(0:しない 1:する) $kiero = 1; #カレンダーを表示しますか?(0:no 1:yes)…同スクリプトに直接アクセスした際に、カレンダーを表示しないで、当月の日記部分のみ表示する場合は1となります i001109 #============================================================================================================================================================================================= #フォームCSS設定 ※使用しない場合は、$css_style = "";とし、そこから2行(先頭がEOMの行までを)を削除して下さい。 $css_style = <<"EOM"; STYLE=font-size:$pt;color:#333333;background-color:#ffffcc;border-style:solid;border-color:#666666;border-width:1; EOM #============================================================================================================================================================================================= #<<< ここから下はいじらない方が身のためです。 ############################################################################### #### Main Process START ##################################################### ############################################################################### $agent = $ENV{'HTTP_USER_AGENT'}; #i000429 if ($agent !~ /MSIE/i) { $css_style = "" ; } #i000429 #<<<システム日時・時刻取得 @cdays = (0,31,28,31,30,31,30,31,31,30,31,30,31); $ENV{'TZ'} = "JST-9"; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $syear = sprintf("%02d",$year + 1900); $smonth = sprintf("%02d",$mon + 1); $sday = sprintf("%02d",$mday); $week = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat') [$wday]; $hour = sprintf("%02d",$hour); $min = sprintf("%02d",$min); $sysdate = "$smonth/$sday($week) $hour:$min"; $hour = sprintf("%2d",$hour); $min = sprintf("%2d",$min); &cookieget; #<</g; $value =~ s/\r|\n/\/g; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/\,/,/g; &jcode'convert(*value,'sjis'); $FORM{$name} = $value; } $FORM{'comment'} =~ s/\r\n/
/g; $FORM{'comment'} =~ s/\r|\n/
/g; } ###<-------------------------------------------------------------- ###<--- ログファイル読み込み ###<-------------------------------------------------------------- sub dataread { @LOG = (); @MAINLOG = () ; @RESLOG = () ; if ( $FORM{'action'} ne 'oldview' ) { if ( !(open(IN,"$logfile")) ) { &error("ログファイル($logfile)がオープン出来ません"); } } else { if ( !(open(IN,"$oldfile")) ) { &error("過去ログファイル($oldfile)がオープン出来ません"); } } @LOG = ; close(IN); foreach ( @LOG ) { ($targetdate,$no,$ic,$title,$resno,$name,$color,$comment,$regdate,$pass,$hst,$ic2,$dmy) = split(/,/,$_); if ( $resno eq '' ) { push(@MAINLOG,"$_") ; } else { push(@RESLOG,"$_") ; } } @RESLOG = reverse @RESLOG ; #レスログは古い順に。 } ###<-------------------------------------------------------------- ###<--- 入力フォーム ###<-------------------------------------------------------------- sub forminput { print "HOME\n"; if ( $icon[0] ne '' ) { print "  アイコン説明\n"; } print "


\n"; if ( $FORM{'proc'} eq "write" ) { print "
\n"; print "\n"; $c_pass = $FORM{'pass'} ; } else { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; $yy = substr($targetdate,0,4); $mm = substr($targetdate,4,2); $dd = substr($targetdate,6,2); print "\n"; print "\n"; print "\n"; } print "\n"; if ( $FORM{'proc'} eq "write" ) { print "\n"; } else { print "\n"; } if ( ( $FORM{'proc'} ne "write" && $c_resno ne '' ) || $minnade == 1 ) { print "\n"; print "\n"; } print "\n"; print ""; if ( $FORM{'proc'} ne "write" && $c_resno ne '' && $minnade == 0 ) { } else { if ( $titleflg == 1 ) { print "\n"; print "\n"; } if ( $icon[0] ne '' ) { print "\n"; print "\n"; } #日記部にアイコン表示&カレンダーアイコンとは異なるアイコンを表示する場合i001109 if ( $disp_icon == 1 && $onaji == 0 ) { print "\n"; print "\n"; } } print "\n"; print "\n"; if ( $cent eq 'yes' ) { $wk = "align=\"center\""; } else { $wk = "align=\"left\""; } print "\n"; } else { print "\n"; } print "
\n"; print "\n"; print "日の日記を書きます。

\n"; print "$yy年$mm月$dd日の日記を修正します。

\n"; print "お名前:
\n"; print "文字色:
\n"; print "タイトル:
\n"; print "カレンダーに表\示するアイコン:\n"; print "
\n"; print "日記に表\示するアイコン:\n"; print "
\n"; print "パスワード:
\n"; if ( $FORM{'proc'} ne "write" && $c_resno ne '' ) { if ( $res_text == 0 ) { print "\n"; } else { print "\n"; } print "
\n"; if ( $FORM{'proc'} eq "write" ) { print ""; } elsif ( $FORM{'proc'} eq "edit" ) { print ""; } else { print ""; } print "   \n"; print "
\n"; } ###<-------------------------------------------------------------- ###<--- カレンダー表示しない場合のヘッダー部表示 ###<-------------------------------------------------------------- sub header_disp { print ">>  HOME\n"; if ( $icon[0] ne '' ) { print "    >>  アイコン説明\n"; } print "
\n"; if ( $titlelogo ne '' ) { print "\n"; } else { print "$titlename\n";} print "

\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "\n"; print "\n"; print "   \n"; print "
 
\n"; #前月・次月スクロールボタン print "\n"; print "\n"; print "\n"; if ( $mon == 1 ) { $wmon1 = 12 ; $wyear1 = $year - 1 ; } else { $wmon1 = $mon - 1 ; $wyear1 = $year ; } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; if ( $mon == 12 ) { $wmon2 = 1 ; $wyear2 = $year + 1 ; } else { $wmon2 = $mon + 1 ; $wyear2 = $year ; } print "\n"; print "\n"; print "\n"; print "
\n"; if ( $back_gif ) { print "\n"; } else { print "\n"; } print " 
\n"; if ( $next_gif ) { print "\n"; } else { print "\n"; } print "
\n"; print "
\n"; print "
\n"; } ###<-------------------------------------------------------------- ###<--- ログ表示 ###<-------------------------------------------------------------- sub view { &dataread ; #ログ読み込み if ( $FORM{'no'} eq '' ) { print "\n"; } @SORTLOG = sort @MAINLOG ; if ( $viewsort == 2 && $FORM{'action'} ne 'download' ) { #昇順の場合 u001109 @SORTLOG = reverse @SORTLOG ; } if ( $kiero == 0 ) { &header_disp ; } #i001105 if ( $FORM{'action'} eq 'oldview') { print "[BACK]
\n"; } #i001216 print "
\n"; $sw = 0 ; if ( $FORM{'action'} eq 'download' || $FORM{'action'} eq 'oldview' ) { $sw = 1 ; } #i001216 foreach $buf ( @SORTLOG ) { ($targetdate,$no,$ic,$title,$resno,$name,$color,$comment,$ps,$regdate,$hst,$ic2,$dmy) = split(/,/,$buf); $yy = substr($targetdate,0,4); $mm = substr($targetdate,4,2); $dd = substr($targetdate,6,2); if ( $FORM{'no'} == $no || $FORM{'all'} == 1 || $FORM{'action'} eq 'oldview' || #u001216 ($FORM{'action'} eq 'download' && $monthview eq 'no' && $yy == $year && $mm == $mon) || #i001109 ($monthview eq 'yes' && $yy == $year && $mm == $mon) || ( $FORM{'no'} eq '' && $monthview ne 'yes' && $yy == $syear && $mm == $smonth && $dd == $sday ) || ( $FORM{'no'} ne '' && $monthview ne 'yes' && $zurazura == 1 && $yy == $year && $mm == $mon && $dd == $day ) ) { if ( substr($mm,0,1) == 0 ) { $mm =~ s/0/ /; } $dd = substr($targetdate,6,2); if ( substr($dd,0,1) == 0 ) { $dd =~ s/0/ /; } if ( $sw == 0 && !($FORM{'all'}) && $FORM{'action'} ne 'oldview') { #u001216 print "$yy年$mm月の日記です
\n" ; #i001105 print "
\n"; $sw = 1 ; } print "
\n"; if ( $FORM{'no'} == $no ) { print "\n"; } $wek = &week_get($yy,$mm); #表示対応年月の1日の曜日を算出 for ( $i = 1 ; $i < $dd ; $i++ ) { if ( $wek == 6 ) { $wek = 0 ; } else { $wek++ ; } } print "\n"; print "\n" if ( $titleflg == 1 ) ; print "\n"; if ( $resflg == 1 && $FORM{'action'} ne 'download' && $FORM{'action'} ne 'oldview') { #u001216 print "\n"; } print "
■…$yy年$mm月$dd日 ($week[$wek])"; print ".......$title\n" if ( $title ) ; print "   ...($name)" if ( $minnade == 1 && $name ) ; print "
\n"; print "\n"; $comment =~ s/([^=^\"]|^)(http|ftp)([\w|\!\#\&\=\-\%\@\~\;\+\:\.\?\/]+)/$1こちら<\/a>/g; print ""; if ( $disp_icon == 1 && $FORM{'action'} ne 'download') { #i001109 print "\n"; } #↑i001109 print "\n"; print "
"; #日記部にアイコン表示&カレンダーアイコンと同じアイコンを表示する場合i001109 if ( $onaji == 1 ) { if ( $icon_w != 0 ) { $w = " width=$icon_w" ; } else { $w = ""; } if ( $icon_h != 0 ) { $h = " height=$icon_h" ; } else { $h = ""; } if ( $icon[0] eq '' ) { if ( $img_gif ) { print "\n" ; } } else { print "\n" ; } } elsif ( $ic2 ne '' ) { #u001114 if ( $icon2_w[$ic2] != 0 ) { $w = " width=$icon2_w[$ic2]" ; } else { $w = ""; } if ( $icon2_h[$ic2] != 0 ) { $h = " height=$icon2_h[$ic2]" ; } else { $h = ""; } print "\n" ; } print ""; print "$comment"; print "
No($no)
\n"; print "
"; $cnt = 0 ; foreach $buf ( @RESLOG ) { ($targetdate,$no2,$ic,$title,$resno,$name,$color,$comment,$regdate,$pass,$hst,$ic2,$dmy) = split(/,/,$buf); if ( $no == $resno ) { print "
" if ( $cnt != 0 ) ; print "\n"; if ( $res_text == 1 ) { print "▼$name 
"; } else { print "$name > "; } $comment =~ s/([^=^\"]|^)(http|ftp)([\w|\!\#\&\=\-\%\@\~\;\+\:\.\?\/]+)/$1こちら<\/a>/g; print "$comment
   ..$regdate ($no2)"; $cnt++ ; } } print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
■名前       ■文字色    ■パスワード 
"; print "\n"; print "\n"; print "\n"; print "
■コメント \n"; if ( $res_text == 0 ) { print "\n"; } else { print "\n"; } print "  
\n"; print "
\n"; } } if ( $sw == 0 ) { if ( substr($mon,0,1) == 0 ) { $mon =~ s/0/ /; } print "
$year年$mon月の日記は書いていません。
\n"; #i001105 $sw == 1 ; } print "

\n"; if ( $kiero == 0 ) { &mtndisp; } #メンテナンス部表示i001106 print "
\n"; } ###<------------------------------------------------------------- ###<--- カレンダー表示部 ###<-------------------------------------------------------------- sub calender { &dataread ; #ログ読み込み print "
\n"; print "
"; if ( $titlelogo ne '' ) { print "
\n"; } else { print "$titlename
\n";} print "
\n"; print "\n"; print "
\n"; $sday2 = &week_get($year,$mon); #表示対象年月の1日の曜日を算出 if ( substr($mon,0,1) == 0 ) { $wmon = $mon ; $wmon =~ s/0/ /; } else { $wmon = $mon ; } print "<< $year年$wmon月 >>\n"; print "\n"; print "
\n"; print "\n"; print "\n"; for ($j = 0 ; $j < 7 ; $j++ ) { print "\n"; } print "\n"; #カレンダーを表示 $j = 0 ; #曜日=日曜日 $editsw = 0 ; $cnt_monday = 0 ; for ( $i = 1; $i <= $cdays[$mon] ;){ if ( $sday2 == 0 || $j == 0) { print "\n"; } if ( $j >= $sday2 || $editsw == 1) { #$sday2=対象月1日の曜日 $editsw = 1 ; $ii = sprintf("%02d",$i); $v = "$mon$ii"; $k = 0; $hol = 0 ; foreach ( @holiday ) { if ( $v == $holiday[$k] ) { if ( $year >= 2000 && ( $v == '0115' || $v == '1010' ) ) { } else { $hol = 1 ; } last ; } $k++; } #成人の日算出 if ( $year >= 2000 && $mon == 1 && $sday2 == 1 ) { #1月で「月曜日」の場合 $cnt_monday++ ; if ( $cnt_monday == 2 ) { $hol = 1 ; } } #体育の日算出 if ( $year >= 2000 && $mon == 10 && $sday2 == 1 ) { #1月で「月曜日」の場合 $cnt_monday++ ; if ( $cnt_monday == 2 ) { $hol = 1 ; } } #「日」 if ( $syear == $year && $smonth == $mon && $sday == $i ) { $bg = "bgcolor=\"$color_today\""; } else { $bg = "bgcolor=\"$calcolor\""; } print "\n"; $sday2++; if ( $sday2 == 7 || $i == $cdays[$mon]) { if ( $i == $cdays[$mon] ) { for ( ; $sday2 < 7 ; $sday2++ ) { print "\n"; } } print "\n"; $sday2 = 0 ; } $i++; $j=99; } else { print "\n"; $j++; } } print "
$week[$j]
"; if ( $hol == 1 || $sday2 == 0 || $svhol == 1) { if ( $hol == 1 || $svhol == 1 ) { print ""; } else { print ""; } } else { if ( $sday2 == 6 ) { print ""; } else { print ""; } } if ( $sw == 1 ) { print "$i"; } else { print "$i"; } print "\n"; #祝日で日曜日の場合、翌日が振替祝日の為、退避 if ( $hol == 1 && $sday2 == 0 ) { $svhol = 1 ; } else { $svhol = 0 ; } #日記帳ログを検索 $set = 0 ; foreach $buf ( @MAINLOG ) { ($targetdate,$no,$ic,$title,$resno,$name,$color,$comment,$regdate,$pass,$hst,$ic2,$dmy) = split(/,/,$buf); $yy = substr($targetdate,0,4); $mm = substr($targetdate,4,2); $dd = substr($targetdate,6,2); if ( $year == $yy && $mon == $mm && $ii == $dd && ( $zurazura == 0 || ( $zurazura == 1 && $set == 0 ) ) ) { $set = 1 ; print "
\n"; if ( $icon_w != 0 ) { $w = " width=$icon_w" ; } else { $w = ""; } if ( $icon_h != 0 ) { $h = " height=$icon_h" ; } else { $h = ""; } if ( $icon[0] eq '' ) { if ( $img_gif ) { print "\n" ; } else { print "■\n" ; } } else { print "\n" ; } } } print "
 
 
\n"; print "
\n"; #前月・次月スクロールボタン print "\n"; print "\n"; if ( $mon == 1 ) { $wmon1 = 12 ; $wyear1 = $year - 1 ; } else { $wmon1 = $mon - 1 ; $wyear1 = $year ; } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; if ( $mon == 12 ) { $wmon2 = 1 ; $wyear2 = $year + 1 ; } else { $wmon2 = $mon + 1 ; $wyear2 = $year ; } print "\n"; print "\n"; print "
\n"; if ( $back_gif ) { print "\n"; } else { print "\n"; } print "
\n"; if ( $next_gif ) { print "\n"; } else { print "\n"; } print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
>>  HOME\n"; if ( $icon[0] ne '' ) { if ( $kiero == 1 || ($disp_icon == 1 && $onaji == 0 && $icon2[0] ne '')) { #i001213 print "    >>  アイコン説明\n"; } #i001213 } print "
 

\n"; print "\n"; print "\n"; print "   \n"; print "
 
\n"; &mtndisp; #メンテナンス部表示 print "
\n"; print "
\n"; print "
\n"; print "
\n"; } ###<-------------------------------------------------------------- ###<--- メンテナンス部表示 ###<-------------------------------------------------------------- sub mtndisp { print "
\n"; print "
\n" if ( $kiero == 1 ) ; #u001105 print ""; print ""; print ""; print ""; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print ""; if ( $oldfile ) { if ( !(open(IN,"$oldfile")) ) { &error("過去ログファイル($oldfile)がオープン出来ません"); } @OLD = ; close(IN); if ( @OLD > 0 ) { print "\n"; print "\n"; print "\n"; print ""; } } print "
"if ( $kiero == 0 ) ; #u001106 print ""if ( $kiero == 1 ) ; #u001106 print "No.\n"; print "pass\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
"if ( $kiero == 0 ) ; #u001106 print ""if ( $kiero == 1 ) ; #u001106 print "No及びパスワードを入力すると投稿記事の修正・削除が可能\です。\n"; if ( $minnade == 0 ) { print "
" if ( $kiero == 0 ) ; print "「日記を書く」は管理人のみの機能\となります。
\n"; } else { print "
" if ( $kiero == 0 ) ; print "この日記はみんなで書く事が可能\です。"; print "
" if ( $kiero == 0 ) ; print "「日記を書く」を選択し「送信」ボタンを押下して下さい。\n"; } print "

\n" ; print "\n"; print "全ての日記を保存\n"; print "
拡張子はhtmに変更して下さい。
"; print "

\n" ; print "\n"; print "
\n"; } ###<-------------------------------------------------------------- ###<--- HTMLヘッダー書き出し ###<-------------------------------------------------------------- sub header { print "Content-type: text/html; charset=Shift_JIS\n\n"; print "\n\n"; print "\n"; print "$titlename\n"; #<<>> print "\n"; #<<>> print "\n"; $wk = "bgcolor=\"$bgcolor\""; $wk2 = "background=\"$backpicture\""; print "\n"; } ###<-------------------------------------------------------------- ###<--- HTMLフッダー書き出し ###<-------------------------------------------------------------- sub footer { #<<< ↓消さないでネ♪ print "

tackynote Ver0.98 Created by Tacky

\n"; print "\n"; } ###<-------------------------------------------------------------- ###<--- ログ出力 ###<-------------------------------------------------------------- sub regist { # ホスト名を取得 $host = $ENV{'REMOTE_HOST'}; $addr = $ENV{'REMOTE_ADDR'}; if ($host eq "" || $host eq "$addr") { ($p1,$p2,$p3,$p4) = split(/\./,$addr); $temp = pack("C4",$p1,$p2,$p3,$p4); $host = gethostbyaddr("$temp", 2); if ($host eq "") { $host = $addr; } } #掲示板荒らし対策 foreach $buf(@DANGER_LIST){ if ( $buf ) { # パターンマッチを変換 $buf=~ s/\./\\./g; $buf=~ s/\?/\./g; $buf=~ s/\*/\.\*/g; if($host =~ /$buf/gi){ &error("\申\し\訳ありません。
あなたのプロバイダーからは投稿できませんでした. "); } } } if ( $maxword ne '' && (length($FORM{'comment'}) > $maxword)) { &error("メッセージは$maxword文字までしか登録出来ません。"); } if ( $FORM{'resno'} ne '' && $FORM{'name'} eq "") { &error("お名前を入力して下さい。"); } if ( $FORM{'comment'} eq "") { &error("メッセージは省略出来ません。"); } &filelock ; #ファイルロック &dataread ; #ログ読み込み $dcnt = @MAINLOG; if ($dcnt >= $datamax ) { if ( $oldfile ) { ($targetdate,$delno,$ic,$title,$resno,$name,$color,$comment,$ps,$regdate,$hst,$ic2,$dmy) = split(/,/,$MAINLOG[$#MAINLOG]); if ( !(open(IN,"$oldfile")) ) { &error("過去ログファイル($oldfile)がオープン出来ません"); } @OLD = ; close(IN); foreach ( @LOG ) { ($targetdate,$dno,$ic,$title,$resno,$name,$color,$comment,$ps,$regdate,$hst,$ic2,$dmy) = split(/,/,$_); if ( $delno == $dno || ( $resno ne '' && $delno == $resno ) ) { unshift(@OLD,$_) ; } else { push(@new,$_); } } if ( !(open(OUT,">$oldfile"))) { &fileunlock ; &error("過去ログファイル($oldfile)のオープンに失敗しました"); } print OUT @OLD; close(OUT); @LOG = @new ; } else { pop(@LOG); } } $dcnt = @LOG; $imonth = sprintf("%02d",$FORM{'month'}); $iday = sprintf("%02d",$FORM{'day'}); if ( $dcnt < 1 ) { $no = 1; #1件目 } else { ($dummy,$no,$dummy) = split(/,/,$LOG[0]); #最新記事No取得 $no++; } # パスワードの暗号化(crypt関数使用)) if ($FORM{'pass'} ne "") { &pass_enc($FORM{'pass'}); } else { $pass = '' ; } unshift(@LOG,"$FORM{'year'}$imonth$iday,$no,$FORM{'icon'},$FORM{'title'},$FORM{'resno'},$FORM{'name'},$FORM{'color'},$FORM{'comment'},$sysdate,$pass,$host,$FORM{'icon2'},\n"); if ( !(open(OUT,">$logfile"))) { &fileunlock ; &error("ログファイル($logfile)のオープンに失敗しました"); } print OUT @LOG; close(OUT); #COOKIE設定 &cookieset ; &fileunlock ; #ファイルロック解除 } ###<-------------------------------------------------------------- ###<--- メンテナンスモード ###<-------------------------------------------------------------- sub Maintenance { if ( $FORM{'no'} eq "") { &error("メンテナンス対象の記事Noを指定して下さい。"); } if ( $FORM{'pass'} eq "") { &error("パスワードを入力して下さい。"); } &dataread ; #ログ読み込み $found = 0 ; foreach $buf ( @LOG ) { ($targetdate,$n,$ic,$title,$resno,$name,$color,$comment,$regdate,$pass,$hst,$ic2,$dmy) = split(/,/,$buf); if ( $FORM{'no'} eq $n ) { if ($FORM{'pass'} ne $password && (&pass_dec($pass))) { &error("パスワードが違います。"); } $found = 1 ; if ( $FORM{'proc'} eq "delete" ) { $FORM{'year'} = substr($targetdate,0,4); $FORM{'month'} = substr($targetdate,4,2); &update ; exit; } &header ; $c_ic = $ic ; $c_ic2 = $ic2 ; $c_title = $title ; $c_name = $name ; $c_color = $color ; $c_resno = $resno ; $c_pass = $FORM{'pass'} ; $c_comment = $comment ; $c_comment =~ s/\/\n/g; &forminput ; last; } } if ( $found == 0 ) { &error("該当する記事Noのデータは存在していません。"); } &footer ; exit; } ###<-------------------------------------------------------------- ###<--- ログファイル更新 ###<-------------------------------------------------------------- sub update { if ( $FORM{'action'} eq 'edit' && $FORM{'comment'} eq "") { &error("何か入力しないとダメっすよ〜"); } $imonth = sprintf("%02d",$FORM{'month'}); $iday = sprintf("%02d",$FORM{'day'}); &filelock ; #ファイルロック &dataread ; #ログ読み込み @new = (); foreach ( @LOG ) { ($targetdate,$n,$ic,$title,$resno,$name,$color,$comment,$regdate,$pass,$hst,$ic2,$d2) = split(/,/,$_); if ( $FORM{'no'} eq $n) { #<<<メンテ対象者の場合 if ( $FORM{'proc'} eq "edit" ) { push(@new,"$FORM{'year'}$imonth$iday,$n,$FORM{'icon'},$FORM{'title'},$resno,$FORM{'name'},$FORM{'color'},$FORM{'comment'},$regdate,$pass,$hst,$FORM{'icon2'},$d2"); } } else { push(@new,"$_"); #<<<そのまま出力 } } if ( !(open(OUT,">$logfile"))) { &fileunlock ; &error("ログファイル($logfile)のオープンに失敗しました"); } print OUT @new; close(OUT); #COOKIE設定 &cookieset ; &fileunlock ; #ファイルロック解除 print "Location: $script?action=move\&year=$FORM{'year'}&month=$imonth&day=$iday&no=999\n\n"; #メインCGIに戻る exit ; } ###<-------------------------------------------------------------- ###<--- 曜日算定 ###<-------------------------------------------------------------- sub week_get { $ydat = $_[0] - $cyear; #現在年〜1989年の年差 $udat = $ydat /4; #上記の年差/4 $days = $cday * $ydat +$udat; #365*年差+閏年の年回数=1989〜前年迄の日数が求まる $days2 = 0; if ($_[1] >= 2){ if (($_[0] % 4) == 0){ if (($_[0] %100) != 0){ $cdays[2] = 29; }elsif (($_[0] % 400) == 0){ $cdays[2] = 29; } } } for ($i = 1; $i < $_[1] ;$i++){ #1月〜対象月前月迄の日数を求める $days2 += $cdays[$i]; } $days += $days2; $youbi = $days % 7; #対象月1日の曜日が求まる return $youbi ; } ###<-------------------------------------------------------------- ###<--- エラー処理 ###<-------------------------------------------------------------- sub error { &header ; print "$_[0]"; &footer; exit; } ###<-------------------------------------------------------------- ###<--- Information(アイコン一覧) ###<-------------------------------------------------------------- sub icondisp { &header ; #<<戻る
\n"; print "
--- アイコンはこんな意味だよ ---

\n"; $i = 0; print "\n"; if ( $kiero == 1 ) { #i001213 print "\n"; foreach ( @icon ) { print "\n"; print "\n"; $i++; } } #i001213 if ( $disp_icon == 1 && $onaji == 0 && $icon2[0] ne '' ) { #↓i001109 print "\n"; print "\n"; $i = 0; foreach ( @icon2 ) { print "\n"; print "\n"; $i++; } } print "
カレンダーアイコンどんな日だったの?
\n"; print "$iconnm[$i]
 
日記のアイコンどんな日だったの?
\n"; print "$iconnm2[$i]



"; &footer ; #<<$lockfile"); close(LOCK); return; } } &error("只今他の方が書き込み中です。ブラウザの「戻る」で戻って再度登録を行って下さい。"); } ###<-------------------------------------------------------------- ###<--- ファイルロック解除 ###<-------------------------------------------------------------- sub fileunlock { if (-e $lockfile) { unlink($lockfile); } } ###<------------------------------------------------------------- ###<--- クッキー取得 ###<-------------------------------------------------------------- sub cookieget { $cookies = $ENV{'HTTP_COOKIE'}; @pairs = split(/;/,$cookies); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ s/ //g; $DUMMY{$name} = $value; } @pairs = split(/,/,$DUMMY{'tackynote'}); foreach $pair (@pairs) { ($name, $value) = split(/\!/, $pair); $COOKIE{$name} = $value; } $c_name = $COOKIE{'nm'} ; $c_color = $COOKIE{'cl'} ; $c_pass = $COOKIE{'ps'} ; } ###<------------------------------------------------------------- ###<--- クッキー設定 ###<-------------------------------------------------------------- sub cookieset { ($secg,$ming,$hourg,$mdayg,$mong,$yearg,$wdayg,$ydayg,$isdstg) =gmtime(time + 30*24*60*60); $yearg += 1900 ; if ($secg < 10) { $secg = "0$secg"; } if ($ming < 10) { $ming = "0$ming"; } if ($hourg < 10) { $hourg = "0$hourg"; } if ($mdayg < 10) { $mdayg = "0$mdayg"; } $mong = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[$mong]; $youbi = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')[$wdayg]; $date_gmt = "$youbi, $mdayg\-$mong\-$yearg $hourg:$ming:$secg GMT"; $cook="nm\!$FORM{'name'},cl\!$FORM{'color'},ps\!$FORM{'pass'}"; print "Set-Cookie: tackynote=$cook; expires=$date_gmt\n"; } ###<------------------------------------------------------------- ###<--- パスワード暗号化 ###<-------------------------------------------------------------- sub pass_enc { if ( $ango == 1 ) { $pass = crypt($_[0], $_[0]); } else { $pass = $_[0]; } } ###<------------------------------------------------------------- ###<--- パスワードチェック ###<-------------------------------------------------------------- sub pass_dec { if ( $ango == 1 ) { if ($_[0] ne '' && ( crypt($FORM{'pass'}, $_[0]) eq $_[0]) ) { return 0 ; } } else { if ($FORM{'pass'} eq $_[0]) { return 0 ; } } return 1; } ###<------------------------------------------------------------- ###<--- ログダウンロードi001108 ###<-------------------------------------------------------------- sub download { print "Content-type: text/download\n\n"; print "$titlename"; $wk = "bgcolor=\"$bgcolor\""; print "\n"; &view ; print "\n"; exit; }