#!/usr/local/bin/perl #オリジナル #┌───────────────────────────────── #│ JOYFUL NOTE v1.33 (2002/06/06) #│ Copyright(C) Kent Web 2002 #│ webmaster@kent-web.com #│ http://www.kent-web.com/ #└───────────────────────────────── #カスタマイズ #┌───────────────────────────────── #│ ROCO ALBUM v1.20 (2003/05/28) #│ Copyright(C) Rocomotion 2002-2003 #│ webmaster@rocomotion.net #│ http://www.rocomotion.net #└───────────────────────────────── $ver = 'ROCO ALBUM v1.20'; #┌───────────────────────────────── #│ [注意事項] #│ 1. このスクリプトはフリーソフトです。このスクリプトを使用した #│ いかなる損害に対して作者は一切の責任を負いません。 #│ 2. 設置に関する質問はサポート掲示板にお願いいたします。 #│ 直接メールによる質問は一切お受けいたしておりません。 #│ 3. 添付の home.gif は L.O.V.E の mayuRin さんによる画像です。 #└───────────────────────────────── #--------- #設定開始 #--------- # 管理者用マスタパスワード (英数字で8文字以内) $pass = 'ceracera'; #--------- #設定完了 #--------- # ライブラリ取込 require './jcode.pl'; require './cgi-lib.pl'; require './ralbum.ini'; # メイン処理 &decode; &axs_check; if ($mode eq "howto") { &howto; } elsif ($mode eq "write") { &form; } elsif ($mode eq "usr_del") { &usr_del; } elsif ($mode eq "usr_edt") { &usr_edt; } elsif ($mode eq "regist") { ®ist; } elsif ($mode eq "past") { &past; } elsif ($mode eq "check") { ✓ } &html_log; #----------------# # アクセス制限 # #----------------# sub axs_check { # ホスト名を取得 &get_host; local($flag)=0; foreach (split(/\s+/, $deny)) { s/\*/\.\*/g; if ($host =~ /$_/i) { $flag=1; last; } } if ($flag) { &error("アクセスを許可されていません"); } } #--------------# # 記事表示部 # #--------------# sub html_log { local($wh,$i,$flag); # ヘッダを出力 &header; # タイトル部 print "
\n"; if ($banner1 ne "") { print "$banner1

\n"; } if ($t_img eq '') { print "$title\n"; } else { print "\"$title\"\n"; } print "

\n"; if ($in{'action'} eq "view") { print "\n"; print "\n"; print "
\n"; print "<< back \n"; print "
\n"; } else { print "\n"; print "\n"; print "\n"; #カウンター処理 if ($in{'action'} ne "view") { if ($counter) { print "
<<topVIEW : \n"; &counter; } } print "
\n"; } print "

\n"; # 記事を展開 open(IN,"$logfile") || &error("Open Error : $logfile"); $top = ; $i=0; $fullpic=0; #ログ表示 if ($in{'action'} eq "view") { while () { ($no,$year1,$month1,$day1,$year2,$month2,$day2,$sub,$tail1,$W1,$H1,$com1,$tail2,$W2,$H2,$com2,$tail3,$W3,$H3,$com3,$tail4,$W4,$H4,$com4,$tail5,$W5,$H5,$com5,$tail6,$W6,$H6,$com6,$tail7,$W7,$H7,$com7,$tail8,$W8,$H8,$com8,$tail9,$W9,$H9,$com9,$tail10,$W10,$H10,$com10,$host) = split(/<>/); # 題名の長さ if (length($sub) > $sub_len*2) { $sub = substr($sub,0,$sub_len*2); $sub .= "..."; } if ($month1 < 10) { $month1 = "0$month1"; } if ($day1 < 10) { $day1 = "0$day1"; } if ($month2 < 10) { $month2 = "0$month2"; } if ($day2 < 10) { $day2 = "0$day2"; } if ($in{'no'} == $no) { print "\n"; print "
\n"; if ($tail1 ne "") { print "\"photo1\"\n"; $fullpic = 1; } if ($tail2 ne "") { print "  \"photo2\"\n"; $fullpic = 2; } if ($tail3 ne "") { print "  \"photo3\"\n"; $fullpic = 3; } if ($tail4 ne "") { print "  \"photo4\"\n"; $fullpic = 4; } if ($tail5 ne "") { print "  \"photo5\"\n"; $fullpic = 5; } if ($tail6 ne "") { print "  \"photo6\"\n"; $fullpic = 6; } if ($tail7 ne "") { print "  \"photo7\"\n"; $fullpic = 7; } if ($tail8 ne "") { print "  \"photo8\"\n"; $fullpic = 8; } if ($tail9 ne "") { print "  \"photo9\"\n"; $fullpic = 9; } if ($tail10 ne "") { print "  \"photo10\"\n"; $fullpic = 10; } $comno = "com$in{'photono'}"; if ($in{'photono'} == 1) { $backphoto = $fullpic; $backtail = "tail$fullpic"; $backW = "W$fullpic"; $backH = "H$fullpic"; } else { $backphoto = $in{'photono'}-1; $backtail = "tail$backphoto"; $backW = "W$backphoto"; $backH = "H$backphoto"; } if ($in{'photono'} == $fullpic) { $nextphoto = 1; $nexttail = "tail1"; $nextW = "W1"; $nextH = "H1"; } else { $nextphoto = $in{'photono'}+1; $nexttail = "tail$nextphoto"; $nextW = "W$nextphoto"; $nextH = "H$nextphoto"; } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\"photo$in{'photono'}\"\n"; print "
\n"; print "    $sub\n"; print "

\n"; print "
$year1/$month1/$day1 〜 $year2/$month2/$day2   
\n"; print "
\n"; print "
photo no.$in{'photono'} / $fullpic   
\n"; print "<< \n"; print " \n"; print ">>  

\n"; print "
comment   
"; print "
$$comno
\n"; print "

\n"; print "
\n"; print "
\n"; print "  
+ralbum+   
\n"; print "KENT , UG   
\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; } } close(IN); } else { print "\n"; while () { ($no,$year1,$month1,$day1,$year2,$month2,$day2,$sub,$tail1,$W1,$H1,$com1,$tail2,$W2,$H2,$com2,$tail3,$W3,$H3,$com3,$tail4,$W4,$H4,$com4,$tail5,$W5,$H5,$com5,$tail6,$W6,$H6,$com6,$tail7,$W7,$H7,$com7,$tail8,$W8,$H8,$com8,$tail9,$W9,$H9,$com9,$tail10,$W10,$H10,$com10,$host) = split(/<>/); $i++; if ($i < $page + 1) { next; } if ($i > $page + $p_log) { next; } # 題名の長さ if (length($sub) > $sub_len*2) { $sub = substr($sub,0,$sub_len*2); $sub .= "..."; } if ($month1 < 10) { $month1 = "0$month1"; } if ($day1 < 10) { $day1 = "0$day1"; } if ($month2 < 10) { $month2 = "0$month2"; } if ($day2 < 10) { $day2 = "0$day2"; } print "\n"; print "\n"; print "\n"; print "\n"; } close(IN); print "
collected works of art clay studio
$year1/$month1/$day1〜$year2/$month2/$day2$sub
\n"; } #新着表示終わり if ($in{'action'} ne "view") { print "\n"; print "\n"; print "
past >>\n" if ($pastkey); print "
\n"; print "

\n"; print "
\n"; print "
+admin+
\n"; print "\n"; print "
\n"; print "\n"; print "\n"; print "PASS \n"; print "  
\n"; print "
\n"; # 著作権表示部 # 削除改変を禁止します print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$banner2
++ ralbum ++
KENT , UG
\n"; print "\n\n\n"; } exit; } #----------------# # ログ書込処理 # #----------------# sub regist { # フォーム入力チェック &form_check; # 時間を取得 &get_time; # クッキーを発行 &set_cookie; # ファイルロック if ($lockkey) { &lock; } # ログを開く open(IN,"$logfile") || &error("Open Error : $logfile"); @lines = ; close(IN); # 記事NO処理 $top = shift(@lines); ($no,$ip,$time2) = split(/<>/, $top); $no++; # 連続投稿チェック if ($addr eq $ip && $wait > $times - $time2) { &error("連続投稿はもうしばらく時間をおいて下さい"); } # ファイル添付処理 if ($in{'upfile1'}) { &UpFile1; } if ($in{'upfile2'}) { &UpFile2; } if ($in{'upfile3'}) { &UpFile3; } if ($in{'upfile4'}) { &UpFile4; } if ($in{'upfile5'}) { &UpFile5; } if ($in{'upfile6'}) { &UpFile6; } if ($in{'upfile7'}) { &UpFile7; } if ($in{'upfile8'}) { &UpFile8; } if ($in{'upfile9'}) { &UpFile9; } if ($in{'upfile10'}) { &UpFile10; } # 親記事の場合 $i=0; $stop=0; foreach (@lines) { ($noa,$year1a,$month1a,$day1a,$year2a,$month2a,$day2a,$suba,$tail1a,$W1a,$H1a,$com1a,$tail2a,$W2a,$H2a,$com2a,$tail3a,$W3a,$H3a,$com3a,$tail4a,$W4a,$H4a,$com4a,$tail5a,$W5a,$H5a,$com5a,$tail6a,$W6a,$H6a,$com6a,$tail7a,$W7a,$H7a,$com7a,$tail8a,$W8a,$H8a,$com8a,$tail9a,$W9a,$H9a,$com9a,$tail10a,$W10a,$H10a,$com10a,$hosta) = split(/<>/); $i++; if ($i > $max-1) { $stop=1; } if (!$stop) { push(@new,$_); } else { if ($pastkey) { push(@data,$_); } } } unshift(@new,"$no<>$in{'year1'}<>$in{'month1'}<>$in{'day1'}<>$in{'year2'}<>$in{'month2'}<>$in{'day2'}<>$in{'sub'}<>$tail1<>$W1<>$H1<>$in{'com1'}<>$tail2<>$W2<>$H2<>$in{'com2'}<>$tail3<>$W3<>$H3<>$in{'com3'}<>$tail4<>$W4<>$H4<>$in{'com4'}<>$tail5<>$W5<>$H5<>$in{'com5'}<>$tail6<>$W6<>$H6<>$in{'com6'}<>$tail7<>$W7<>$H7<>$in{'com7'}<>$tail8<>$W8<>$H8<>$in{'com8'}<>$tail9<>$W9<>$H9<>$in{'com9'}<>$tail10<>$W10<>$H10<>$in{'com10'}<>$host<>\n"); unshift(@new,"$no<>$addr<>$times<>\n"); # 過去ログ更新 if ($data[0]) { &pastlog; } # 更新 open(OUT,">$logfile") || &error("Write Error : $logfile"); print OUT @new; close(OUT); # ロック解除 if ($lockkey) { &unlock; } } #--------------------# # 画像アップロード # #--------------------# sub UpFile1 { # 画像処理 $macbin=0; $i=0;$j=0;$k=0; foreach (@in) { if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; $i++} if ($_ =~ /(.*)filename=(.*)/i) { $fname=$2; $j++} if ($_ =~ /application\/x-macbinary/i) { $macbin=1; $k++} if ($i==1 || $j==1 || $k==1) {$tailout=$tail; $fnameout=$fname; $macbinout=$macbin;} } $tail = $tailout; $fname = $fnameout; $macbin= $macbinout; $tail =~ s/\r//g; $tail =~ s/\n//g; $fname =~ tr/\"\x0D\x0A//d; # ファイル形式を認識 $flag=0; if ($tail =~ /image\/gif/i && $gif) { $tail=".gif"; $flag=1; } if ($tail =~ /image\/jpeg/i && $jpeg) { $tail=".jpg"; $flag=1; } if ($tail =~ /image\/x-png/i && $png) { $tail=".png"; $flag=1; } if (!$flag) { if ($fname =~ /\.gif$/i && $gif) { $tail=".gif"; $flag=1; } if (($fname =~ /\.jpe?g$/i && $jpeg)) { $tail=".jpg"; $flag=1; } if ($fname =~ /\.png$/i && $png) { $tail=".png"; $flag=1; } } # アップロード失敗処理 if (!$flag && !$clip_error) { return; } elsif (!$flag && $clip_error) { &error("FILE1はアップロードできないファイル形式です","lock"); } $upfile = $in{'upfile1'}; # マックバイナリ対策 if ($macbin) { $length = substr($upfile,83,4); $length = unpack("%N",$length); $upfile = substr($upfile,128,$length); } # 添付データを書き込み $ImgFile = "$ImgDir$no-1$tail"; open(OUT,"> $ImgFile") || &error("FILE1の画像のアップロードに失敗しました","lock"); binmode(OUT); binmode(STDOUT); print OUT $upfile; close(OUT); chmod (0666,$ImgFile); # 画像サイズ取得 if ($tail eq ".jpg") { ($W, $H) = &JpegSize($ImgFile); } elsif ($tail eq ".gif") { ($W, $H) = &GifSize($ImgFile); } elsif ($tail eq ".png") { ($W, $H) = &PngSize($ImgFile); } # 画像表示縮小 if ($W > $MaxW || $H > $MaxH) { $WW = $MaxW / $W; $HH = $MaxH / $H; if ($WW < $HH) { $key = $WW; } else { $key = $HH; } $W = int ($W * $key) || 1; $H = int ($H * $key) || 1; } $tail1 = $tail; $fname1 = $fname; $W1 = $W; $H1 = $H; } #--------------------# # 画像アップロード # #--------------------# sub UpFile2 { # 画像処理 $macbin=0; $i=0;$j=0;$k=0; foreach (@in) { if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; $i++} if ($_ =~ /(.*)filename=(.*)/i) { $fname=$2; $j++} if ($_ =~ /application\/x-macbinary/i) { $macbin=1; $k++} if ($i==2 || $j==2 || $k==2) {$tailout=$tail; $fnameout=$fname; $macbinout=$macbin;} } $tail = $tailout; $fname = $fnameout; $macbin= $macbinout; $tail =~ s/\r//g; $tail =~ s/\n//g; $fname =~ tr/\"\x0D\x0A//d; # ファイル形式を認識 $flag=0; if ($tail =~ /image\/gif/i && $gif) { $tail=".gif"; $flag=1; } if ($tail =~ /image\/jpeg/i && $jpeg) { $tail=".jpg"; $flag=1; } if ($tail =~ /image\/x-png/i && $png) { $tail=".png"; $flag=1; } if (!$flag) { if ($fname =~ /\.gif$/i && $gif) { $tail=".gif"; $flag=1; } if (($fname =~ /\.jpe?g$/i && $jpeg)) { $tail=".jpg"; $flag=1; } if ($fname =~ /\.png$/i && $png) { $tail=".png"; $flag=1; } } # アップロード失敗処理 if (!$flag && !$clip_error) { return; } elsif (!$flag && $clip_error) { &error("FILE2はアップロードできないファイル形式です","lock"); } $upfile = $in{'upfile2'}; # マックバイナリ対策 if ($macbin) { $length = substr($upfile,83,4); $length = unpack("%N",$length); $upfile = substr($upfile,128,$length); } # 添付データを書き込み $ImgFile = "$ImgDir$no-2$tail"; open(OUT,"> $ImgFile") || &error("FILE2の画像のアップロードに失敗しました","lock"); binmode(OUT); binmode(STDOUT); print OUT $upfile; close(OUT); chmod (0666,$ImgFile); # 画像サイズ取得 if ($tail eq ".jpg") { ($W, $H) = &JpegSize($ImgFile); } elsif ($tail eq ".gif") { ($W, $H) = &GifSize($ImgFile); } elsif ($tail eq ".png") { ($W, $H) = &PngSize($ImgFile); } # 画像表示縮小 if ($W > $MaxW || $H > $MaxH) { $WW = $MaxW / $W; $HH = $MaxH / $H; if ($WW < $HH) { $key = $WW; } else { $key = $HH; } $W = int ($W * $key) || 1; $H = int ($H * $key) || 1; } $tail2 = $tail; $fname2 = $fname; $W2 = $W; $H2 = $H; } #--------------------# # 画像アップロード # #--------------------# sub UpFile3 { # 画像処理 $macbin=0; $i=0;$j=0;$k=0; foreach (@in) { if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; $i++} if ($_ =~ /(.*)filename=(.*)/i) { $fname=$2; $j++} if ($_ =~ /application\/x-macbinary/i) { $macbin=1; $k++} if ($i==3 || $j==3 || $k==3) {$tailout=$tail; $fnameout=$fname; $macbinout=$macbin;} } $tail = $tailout; $fname = $fnameout; $macbin= $macbinout; $tail =~ s/\r//g; $tail =~ s/\n//g; $fname =~ tr/\"\x0D\x0A//d; # ファイル形式を認識 $flag=0; if ($tail =~ /image\/gif/i && $gif) { $tail=".gif"; $flag=1; } if ($tail =~ /image\/jpeg/i && $jpeg) { $tail=".jpg"; $flag=1; } if ($tail =~ /image\/x-png/i && $png) { $tail=".png"; $flag=1; } if (!$flag) { if ($fname =~ /\.gif$/i && $gif) { $tail=".gif"; $flag=1; } if (($fname =~ /\.jpe?g$/i && $jpeg)) { $tail=".jpg"; $flag=1; } if ($fname =~ /\.png$/i && $png) { $tail=".png"; $flag=1; } } # アップロード失敗処理 if (!$flag && !$clip_error) { return; } elsif (!$flag && $clip_error) { &error("FILE3はアップロードできないファイル形式です","lock"); } $upfile = $in{'upfile3'}; # マックバイナリ対策 if ($macbin) { $length = substr($upfile,83,4); $length = unpack("%N",$length); $upfile = substr($upfile,128,$length); } # 添付データを書き込み $ImgFile = "$ImgDir$no-3$tail"; open(OUT,"> $ImgFile") || &error("FILE3の画像のアップロードに失敗しました","lock"); binmode(OUT); binmode(STDOUT); print OUT $upfile; close(OUT); chmod (0666,$ImgFile); # 画像サイズ取得 if ($tail eq ".jpg") { ($W, $H) = &JpegSize($ImgFile); } elsif ($tail eq ".gif") { ($W, $H) = &GifSize($ImgFile); } elsif ($tail eq ".png") { ($W, $H) = &PngSize($ImgFile); } # 画像表示縮小 if ($W > $MaxW || $H > $MaxH) { $WW = $MaxW / $W; $HH = $MaxH / $H; if ($WW < $HH) { $key = $WW; } else { $key = $HH; } $W = int ($W * $key) || 1; $H = int ($H * $key) || 1; } $tail3 = $tail; $fname3 = $fname; $W3 = $W; $H3 = $H; } #--------------------# # 画像アップロード # #--------------------# sub UpFile4 { # 画像処理 $macbin=0; $i=0;$j=0;$k=0; foreach (@in) { if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; $i++} if ($_ =~ /(.*)filename=(.*)/i) { $fname=$2; $j++} if ($_ =~ /application\/x-macbinary/i) { $macbin=1; $k++} if ($i==4 || $j==4 || $k==4) {$tailout=$tail; $fnameout=$fname; $macbinout=$macbin;} } $tail = $tailout; $fname = $fnameout; $macbin= $macbinout; $tail =~ s/\r//g; $tail =~ s/\n//g; $fname =~ tr/\"\x0D\x0A//d; # ファイル形式を認識 $flag=0; if ($tail =~ /image\/gif/i && $gif) { $tail=".gif"; $flag=1; } if ($tail =~ /image\/jpeg/i && $jpeg) { $tail=".jpg"; $flag=1; } if ($tail =~ /image\/x-png/i && $png) { $tail=".png"; $flag=1; } if (!$flag) { if ($fname =~ /\.gif$/i && $gif) { $tail=".gif"; $flag=1; } if (($fname =~ /\.jpe?g$/i && $jpeg)) { $tail=".jpg"; $flag=1; } if ($fname =~ /\.png$/i && $png) { $tail=".png"; $flag=1; } } # アップロード失敗処理 if (!$flag && !$clip_error) { return; } elsif (!$flag && $clip_error) { &error("FILE4はアップロードできないファイル形式です","lock"); } $upfile = $in{'upfile4'}; # マックバイナリ対策 if ($macbin) { $length = substr($upfile,83,4); $length = unpack("%N",$length); $upfile = substr($upfile,128,$length); } # 添付データを書き込み $ImgFile = "$ImgDir$no-4$tail"; open(OUT,"> $ImgFile") || &error("FILE4の画像のアップロードに失敗しました","lock"); binmode(OUT); binmode(STDOUT); print OUT $upfile; close(OUT); chmod (0666,$ImgFile); # 画像サイズ取得 if ($tail eq ".jpg") { ($W, $H) = &JpegSize($ImgFile); } elsif ($tail eq ".gif") { ($W, $H) = &GifSize($ImgFile); } elsif ($tail eq ".png") { ($W, $H) = &PngSize($ImgFile); } # 画像表示縮小 if ($W > $MaxW || $H > $MaxH) { $WW = $MaxW / $W; $HH = $MaxH / $H; if ($WW < $HH) { $key = $WW; } else { $key = $HH; } $W = int ($W * $key) || 1; $H = int ($H * $key) || 1; } $tail4 = $tail; $fname4 = $fname; $W4 = $W; $H4 = $H; } #--------------------# # 画像アップロード # #--------------------# sub UpFile5 { # 画像処理 $macbin=0; $i=0;$j=0;$k=0; foreach (@in) { if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; $i++} if ($_ =~ /(.*)filename=(.*)/i) { $fname=$2; $j++} if ($_ =~ /application\/x-macbinary/i) { $macbin=1; $k++} if ($i==5 || $j==5 || $k==5) {$tailout=$tail; $fnameout=$fname; $macbinout=$macbin;} } $tail = $tailout; $fname = $fnameout; $macbin= $macbinout; $tail =~ s/\r//g; $tail =~ s/\n//g; $fname =~ tr/\"\x0D\x0A//d; # ファイル形式を認識 $flag=0; if ($tail =~ /image\/gif/i && $gif) { $tail=".gif"; $flag=1; } if ($tail =~ /image\/jpeg/i && $jpeg) { $tail=".jpg"; $flag=1; } if ($tail =~ /image\/x-png/i && $png) { $tail=".png"; $flag=1; } if (!$flag) { if ($fname =~ /\.gif$/i && $gif) { $tail=".gif"; $flag=1; } if (($fname =~ /\.jpe?g$/i && $jpeg)) { $tail=".jpg"; $flag=1; } if ($fname =~ /\.png$/i && $png) { $tail=".png"; $flag=1; } } # アップロード失敗処理 if (!$flag && !$clip_error) { return; } elsif (!$flag && $clip_error) { &error("FILE5はアップロードできないファイル形式です","lock"); } $upfile = $in{'upfile5'}; # マックバイナリ対策 if ($macbin) { $length = substr($upfile,83,4); $length = unpack("%N",$length); $upfile = substr($upfile,128,$length); } # 添付データを書き込み $ImgFile = "$ImgDir$no-5$tail"; open(OUT,"> $ImgFile") || &error("FILE5の画像のアップロードに失敗しました","lock"); binmode(OUT); binmode(STDOUT); print OUT $upfile; close(OUT); chmod (0666,$ImgFile); # 画像サイズ取得 if ($tail eq ".jpg") { ($W, $H) = &JpegSize($ImgFile); } elsif ($tail eq ".gif") { ($W, $H) = &GifSize($ImgFile); } elsif ($tail eq ".png") { ($W, $H) = &PngSize($ImgFile); } # 画像表示縮小 if ($W > $MaxW || $H > $MaxH) { $WW = $MaxW / $W; $HH = $MaxH / $H; if ($WW < $HH) { $key = $WW; } else { $key = $HH; } $W = int ($W * $key) || 1; $H = int ($H * $key) || 1; } $tail5 = $tail; $fname5 = $fname; $W5 = $W; $H5 = $H; } #--------------------# # 画像アップロード # #--------------------# sub UpFile6 { # 画像処理 $macbin=0; $i=0;$j=0;$k=0; foreach (@in) { if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; $i++} if ($_ =~ /(.*)filename=(.*)/i) { $fname=$2; $j++} if ($_ =~ /application\/x-macbinary/i) { $macbin=1; $k++} if ($i==6 || $j==6 || $k==6) {$tailout=$tail; $fnameout=$fname; $macbinout=$macbin;} } $tail = $tailout; $fname = $fnameout; $macbin= $macbinout; $tail =~ s/\r//g; $tail =~ s/\n//g; $fname =~ tr/\"\x0D\x0A//d; # ファイル形式を認識 $flag=0; if ($tail =~ /image\/gif/i && $gif) { $tail=".gif"; $flag=1; } if ($tail =~ /image\/jpeg/i && $jpeg) { $tail=".jpg"; $flag=1; } if ($tail =~ /image\/x-png/i && $png) { $tail=".png"; $flag=1; } if (!$flag) { if ($fname =~ /\.gif$/i && $gif) { $tail=".gif"; $flag=1; } if (($fname =~ /\.jpe?g$/i && $jpeg)) { $tail=".jpg"; $flag=1; } if ($fname =~ /\.png$/i && $png) { $tail=".png"; $flag=1; } } # アップロード失敗処理 if (!$flag && !$clip_error) { return; } elsif (!$flag && $clip_error) { &error("FILE6はアップロードできないファイル形式です","lock"); } $upfile = $in{'upfile6'}; # マックバイナリ対策 if ($macbin) { $length = substr($upfile,83,4); $length = unpack("%N",$length); $upfile = substr($upfile,128,$length); } # 添付データを書き込み $ImgFile = "$ImgDir$no-6$tail"; open(OUT,"> $ImgFile") || &error("FILE6の画像のアップロードに失敗しました","lock"); binmode(OUT); binmode(STDOUT); print OUT $upfile; close(OUT); chmod (0666,$ImgFile); # 画像サイズ取得 if ($tail eq ".jpg") { ($W, $H) = &JpegSize($ImgFile); } elsif ($tail eq ".gif") { ($W, $H) = &GifSize($ImgFile); } elsif ($tail eq ".png") { ($W, $H) = &PngSize($ImgFile); } # 画像表示縮小 if ($W > $MaxW || $H > $MaxH) { $WW = $MaxW / $W; $HH = $MaxH / $H; if ($WW < $HH) { $key = $WW; } else { $key = $HH; } $W = int ($W * $key) || 1; $H = int ($H * $key) || 1; } $tail6 = $tail; $fname6 = $fname; $W6 = $W; $H6 = $H; } #--------------------# # 画像アップロード # #--------------------# sub UpFile7 { # 画像処理 $macbin=0; $i=0;$j=0;$k=0; foreach (@in) { if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; $i++} if ($_ =~ /(.*)filename=(.*)/i) { $fname=$2; $j++} if ($_ =~ /application\/x-macbinary/i) { $macbin=1; $k++} if ($i==7 || $j==7 || $k==7) {$tailout=$tail; $fnameout=$fname; $macbinout=$macbin;} } $tail = $tailout; $fname = $fnameout; $macbin= $macbinout; $tail =~ s/\r//g; $tail =~ s/\n//g; $fname =~ tr/\"\x0D\x0A//d; # ファイル形式を認識 $flag=0; if ($tail =~ /image\/gif/i && $gif) { $tail=".gif"; $flag=1; } if ($tail =~ /image\/jpeg/i && $jpeg) { $tail=".jpg"; $flag=1; } if ($tail =~ /image\/x-png/i && $png) { $tail=".png"; $flag=1; } if (!$flag) { if ($fname =~ /\.gif$/i && $gif) { $tail=".gif"; $flag=1; } if (($fname =~ /\.jpe?g$/i && $jpeg)) { $tail=".jpg"; $flag=1; } if ($fname =~ /\.png$/i && $png) { $tail=".png"; $flag=1; } } # アップロード失敗処理 if (!$flag && !$clip_error) { return; } elsif (!$flag && $clip_error) { &error("FILE7はアップロードできないファイル形式です","lock"); } $upfile = $in{'upfile7'}; # マックバイナリ対策 if ($macbin) { $length = substr($upfile,83,4); $length = unpack("%N",$length); $upfile = substr($upfile,128,$length); } # 添付データを書き込み $ImgFile = "$ImgDir$no-7$tail"; open(OUT,"> $ImgFile") || &error("FILE7の画像のアップロードに失敗しました","lock"); binmode(OUT); binmode(STDOUT); print OUT $upfile; close(OUT); chmod (0666,$ImgFile); # 画像サイズ取得 if ($tail eq ".jpg") { ($W, $H) = &JpegSize($ImgFile); } elsif ($tail eq ".gif") { ($W, $H) = &GifSize($ImgFile); } elsif ($tail eq ".png") { ($W, $H) = &PngSize($ImgFile); } # 画像表示縮小 if ($W > $MaxW || $H > $MaxH) { $WW = $MaxW / $W; $HH = $MaxH / $H; if ($WW < $HH) { $key = $WW; } else { $key = $HH; } $W = int ($W * $key) || 1; $H = int ($H * $key) || 1; } $tail7 = $tail; $fname7 = $fname; $W7 = $W; $H7 = $H; } #--------------------# # 画像アップロード # #--------------------# sub UpFile8 { # 画像処理 $macbin=0; $i=0;$j=0;$k=0; foreach (@in) { if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; $i++} if ($_ =~ /(.*)filename=(.*)/i) { $fname=$2; $j++} if ($_ =~ /application\/x-macbinary/i) { $macbin=1; $k++} if ($i==8 || $j==8 || $k==8) {$tailout=$tail; $fnameout=$fname; $macbinout=$macbin;} } $tail = $tailout; $fname = $fnameout; $macbin= $macbinout; $tail =~ s/\r//g; $tail =~ s/\n//g; $fname =~ tr/\"\x0D\x0A//d; # ファイル形式を認識 $flag=0; if ($tail =~ /image\/gif/i && $gif) { $tail=".gif"; $flag=1; } if ($tail =~ /image\/jpeg/i && $jpeg) { $tail=".jpg"; $flag=1; } if ($tail =~ /image\/x-png/i && $png) { $tail=".png"; $flag=1; } if (!$flag) { if ($fname =~ /\.gif$/i && $gif) { $tail=".gif"; $flag=1; } if (($fname =~ /\.jpe?g$/i && $jpeg)) { $tail=".jpg"; $flag=1; } if ($fname =~ /\.png$/i && $png) { $tail=".png"; $flag=1; } } # アップロード失敗処理 if (!$flag && !$clip_error) { return; } elsif (!$flag && $clip_error) { &error("FILE8はアップロードできないファイル形式です","lock"); } $upfile = $in{'upfile8'}; # マックバイナリ対策 if ($macbin) { $length = substr($upfile,83,4); $length = unpack("%N",$length); $upfile = substr($upfile,128,$length); } # 添付データを書き込み $ImgFile = "$ImgDir$no-8$tail"; open(OUT,"> $ImgFile") || &error("FILE2の画像のアップロードに失敗しました","lock"); binmode(OUT); binmode(STDOUT); print OUT $upfile; close(OUT); chmod (0666,$ImgFile); # 画像サイズ取得 if ($tail eq ".jpg") { ($W, $H) = &JpegSize($ImgFile); } elsif ($tail eq ".gif") { ($W, $H) = &GifSize($ImgFile); } elsif ($tail eq ".png") { ($W, $H) = &PngSize($ImgFile); } # 画像表示縮小 if ($W > $MaxW || $H > $MaxH) { $WW = $MaxW / $W; $HH = $MaxH / $H; if ($WW < $HH) { $key = $WW; } else { $key = $HH; } $W = int ($W * $key) || 1; $H = int ($H * $key) || 1; } $tail8 = $tail; $fname8 = $fname; $W8 = $W; $H8 = $H; } #--------------------# # 画像アップロード # #--------------------# sub UpFile9 { # 画像処理 $macbin=0; $i=0;$j=0;$k=0; foreach (@in) { if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; $i++} if ($_ =~ /(.*)filename=(.*)/i) { $fname=$2; $j++} if ($_ =~ /application\/x-macbinary/i) { $macbin=1; $k++} if ($i==9 || $j==9 || $k==9) {$tailout=$tail; $fnameout=$fname; $macbinout=$macbin;} } $tail = $tailout; $fname = $fnameout; $macbin= $macbinout; $tail =~ s/\r//g; $tail =~ s/\n//g; $fname =~ tr/\"\x0D\x0A//d; # ファイル形式を認識 $flag=0; if ($tail =~ /image\/gif/i && $gif) { $tail=".gif"; $flag=1; } if ($tail =~ /image\/jpeg/i && $jpeg) { $tail=".jpg"; $flag=1; } if ($tail =~ /image\/x-png/i && $png) { $tail=".png"; $flag=1; } if (!$flag) { if ($fname =~ /\.gif$/i && $gif) { $tail=".gif"; $flag=1; } if (($fname =~ /\.jpe?g$/i && $jpeg)) { $tail=".jpg"; $flag=1; } if ($fname =~ /\.png$/i && $png) { $tail=".png"; $flag=1; } } # アップロード失敗処理 if (!$flag && !$clip_error) { return; } elsif (!$flag && $clip_error) { &error("FILE9はアップロードできないファイル形式です","lock"); } $upfile = $in{'upfile9'}; # マックバイナリ対策 if ($macbin) { $length = substr($upfile,83,4); $length = unpack("%N",$length); $upfile = substr($upfile,128,$length); } # 添付データを書き込み $ImgFile = "$ImgDir$no-9$tail"; open(OUT,"> $ImgFile") || &error("FILE2の画像のアップロードに失敗しました","lock"); binmode(OUT); binmode(STDOUT); print OUT $upfile; close(OUT); chmod (0666,$ImgFile); # 画像サイズ取得 if ($tail eq ".jpg") { ($W, $H) = &JpegSize($ImgFile); } elsif ($tail eq ".gif") { ($W, $H) = &GifSize($ImgFile); } elsif ($tail eq ".png") { ($W, $H) = &PngSize($ImgFile); } # 画像表示縮小 if ($W > $MaxW || $H > $MaxH) { $WW = $MaxW / $W; $HH = $MaxH / $H; if ($WW < $HH) { $key = $WW; } else { $key = $HH; } $W = int ($W * $key) || 1; $H = int ($H * $key) || 1; } $tail9 = $tail; $fname9 = $fname; $W9 = $W; $H9 = $H; } #--------------------# # 画像アップロード # #--------------------# sub UpFile10 { # 画像処理 $macbin=0; $i=0;$j=0;$k=0; foreach (@in) { if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; $i++} if ($_ =~ /(.*)filename=(.*)/i) { $fname=$2; $j++} if ($_ =~ /application\/x-macbinary/i) { $macbin=1; $k++} if ($i==10 || $j==10 || $k==10) {$tailout=$tail; $fnameout=$fname; $macbinout=$macbin;} } $tail = $tailout; $fname = $fnameout; $macbin= $macbinout; $tail =~ s/\r//g; $tail =~ s/\n//g; $fname =~ tr/\"\x0D\x0A//d; # ファイル形式を認識 $flag=0; if ($tail =~ /image\/gif/i && $gif) { $tail=".gif"; $flag=1; } if ($tail =~ /image\/jpeg/i && $jpeg) { $tail=".jpg"; $flag=1; } if ($tail =~ /image\/x-png/i && $png) { $tail=".png"; $flag=1; } if (!$flag) { if ($fname =~ /\.gif$/i && $gif) { $tail=".gif"; $flag=1; } if (($fname =~ /\.jpe?g$/i && $jpeg)) { $tail=".jpg"; $flag=1; } if ($fname =~ /\.png$/i && $png) { $tail=".png"; $flag=1; } } # アップロード失敗処理 if (!$flag && !$clip_error) { return; } elsif (!$flag && $clip_error) { &error("FILE10はアップロードできないファイル形式です","lock"); } $upfile = $in{'upfile10'}; # マックバイナリ対策 if ($macbin) { $length = substr($upfile,83,4); $length = unpack("%N",$length); $upfile = substr($upfile,128,$length); } # 添付データを書き込み $ImgFile = "$ImgDir$no-10$tail"; open(OUT,"> $ImgFile") || &error("FILE10の画像のアップロードに失敗しました","lock"); binmode(OUT); binmode(STDOUT); print OUT $upfile; close(OUT); chmod (0666,$ImgFile); # 画像サイズ取得 if ($tail eq ".jpg") { ($W, $H) = &JpegSize($ImgFile); } elsif ($tail eq ".gif") { ($W, $H) = &GifSize($ImgFile); } elsif ($tail eq ".png") { ($W, $H) = &PngSize($ImgFile); } # 画像表示縮小 if ($W > $MaxW || $H > $MaxH) { $WW = $MaxW / $W; $HH = $MaxH / $H; if ($WW < $HH) { $key = $WW; } else { $key = $HH; } $W = int ($W * $key) || 1; $H = int ($H * $key) || 1; } $tail10 = $tail; $fname10 = $fname; $W10 = $W; $H10 = $H; } #----------------# # デコード処理 # #----------------# sub decode { &ReadParse; while (($key,$val) = each %in) { if ($key ne "upfile1" && $key ne "upfile2" && $key ne "upfile3" && $key ne "upfile4" && $key ne "upfile5" && $key ne "upfile6" && $key ne "upfile7" && $key ne "upfile8" && $key ne "upfile9" && $key ne "upfile10") { # シフトJISコードに変換 &jcode'convert(*val, "sjis", "", "z"); # タグ処理 $val =~ s/&/&/g; $val =~ s/"/"/g; $val =~ s//>/g; # 改行処理 if ($key eq "com1" || $key eq "com2" || $key eq "com3" || $key eq "com4" || $key eq "com5" || $key eq "com6" || $key eq "com7" || $key eq "com8" || $key eq "com9" || $key eq "com10") { $val =~ s/\r\n/
/g; $val =~ s/\r/
/g; $val =~ s/\n/
/g; } else { $val =~ s/\r//g; $val =~ s/\n//g; } } $in{$key} = $val; } $mode = $in{'mode'}; $page = $in{'page'}; $in{'url'} =~ s/^http\:\/\///; if ($in{'sub'} eq "") { $in{'sub'} = "+ NO TITLE +"; } } #------------------# # クッキーの発行 # #------------------# sub set_cookie { local($gmt, $cook, @t, @m, @w); @t = gmtime(time + 60*24*60*60); @m = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); @w = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat'); $gmt = sprintf("%s, %02d-%s-%04d %02d:%02d:%02d GMT", $w[$t[6]], $t[3], $m[$t[4]], $t[5]+1900, $t[2], $t[1], $t[0]); $cook="pwd<>$in{'pwd'}<>"; print "Set-Cookie: ROCOALBUM=$cook; expires=$gmt\n"; } #------------------# # クッキーを取得 # #------------------# sub get_cookie { local($key, $val, @cook); @cook = split(/;/, $ENV{'HTTP_COOKIE'}); foreach (@cook) { ($key, $val) = split(/=/); $key =~ s/\s//g; $tmp{$key} = $val; } %ck = split(/<>/, $tmp{'ROCOALBUM'}); } #--------------# # エラー処理 # #--------------# sub error { &unlock if ($lockflag); &header if (!$head_flag); print "

ERROR !

\n"; print "$_[0]\n"; print "


\n"; print "\n"; exit; } #------------------# # ユーザ記事削除 # #------------------# sub usr_del { if ($in{'no'} eq '' || $in{'pwd'} eq '') { &error("記事Noまたは削除キーが入力モレです"); } if ($in{'pwd'} ne $pass) { &error("PASSが違います"); } # ロック処理 if ($lockkey) { &lock; } if ($in{'pastlog'} eq "") { open(IN,"$logfile") || &error("Open Error : $logfile"); @lines = ; close(IN); $top = shift(@lines); } else { open(IN,"$pastdir$in{'pastlog'}.log") || &error("Open Error : $pastdir$in{'pastlog'}.log"); @lines = ; close(IN); } $flag=0; foreach (@lines) { ($no,$year1,$month1,$day1,$year2,$month2,$day2,$sub,$tail1,$W1,$H1,$com1,$tail2,$W2,$H2,$com2,$tail3,$W3,$H3,$com3,$tail4,$W4,$H4,$com4,$tail5,$W5,$H5,$com5,$tail6,$W6,$H6,$com6,$tail7,$W7,$H7,$com7,$tail8,$W8,$H8,$com8,$tail9,$W9,$H9,$com9,$tail10,$W10,$H10,$com10,$host) = split(/<>/); if ($flag == 0 && $in{'no'} eq "$no") { # 添付ファイル削除 if (-e "$ImgDir$no-1$tail1") { unlink("$ImgDir$no-1$tail1"); } if (-e "$ImgDir$no-2$tail2") { unlink("$ImgDir$no-2$tail2"); } if (-e "$ImgDir$no-3$tail3") { unlink("$ImgDir$no-3$tail3"); } if (-e "$ImgDir$no-4$tail4") { unlink("$ImgDir$no-4$tail4"); } if (-e "$ImgDir$no-5$tail5") { unlink("$ImgDir$no-5$tail5"); } if (-e "$ImgDir$no-6$tail6") { unlink("$ImgDir$no-6$tail6"); } if (-e "$ImgDir$no-7$tail7") { unlink("$ImgDir$no-7$tail7"); } if (-e "$ImgDir$no-8$tail8") { unlink("$ImgDir$no-8$tail8"); } if (-e "$ImgDir$no-9$tail9") { unlink("$ImgDir$no-9$tail9"); } if (-e "$ImgDir$no-10$tail10") { unlink("$ImgDir$no-10$tail10"); } $flag=1; } else { push(@new,$_); } } if ($flag == 0) { &error("該当記事が見当たりません"); } # 更新 if ($in{'pastlog'} eq "") { unshift(@new,$top); open(OUT,">$logfile") || &error("Open Error : $logfile"); } else { open(OUT,">$pastdir$in{'pastlog'}.log") || &error("Open Error : $pastdir$in{'pastlog'}.log"); } print OUT @new; close(OUT); # ロック解除 if ($lockkey) { &unlock; } } #----------------# # 記事修正処理 # #----------------# sub usr_edt { if ($in{'no'} eq '' || $in{'pwd'} eq '') { &error("記事Noまたはパスワードが入力モレです"); } if ($in{'action'} eq "edit") { # フォーム入力チェック &form_check; # ロック処理 &lock if ($lockkey); } #クッキーを取得 &get_cookie; $flag=0; if ($in{'pastlog'} eq "") { open(IN,"$logfile") || &error("Open Error : $logfile"); $top = ; } else { open(IN,"$pastdir$in{'pastlog'}.log") || &error("Open Error : $pastdir$in{'pastlog'}.log"); } while () { ($no,$year1,$month1,$day1,$year2,$month2,$day2,$sub,$tail1,$W1,$H1,$com1,$tail2,$W2,$H2,$com2,$tail3,$W3,$H3,$com3,$tail4,$W4,$H4,$com4,$tail5,$W5,$H5,$com5,$tail6,$W6,$H6,$com6,$tail7,$W7,$H7,$com7,$tail8,$W8,$H8,$com8,$tail9,$W9,$H9,$com9,$tail10,$W10,$H10,$com10,$host) = split(/<>/); if ($in{'no'} == $no) { $flag=1; if ($in{'action'} ne "edit") { last; } else { # ファイル添付処理 if ($in{'upfile1'}) { if (-e "$ImgDir$no-1$tail1") { unlink("$ImgDir$no-1$tail1"); } &UpFile1; } if ($in{'upfile2'}) { if (-e "$ImgDir$no-2$tail2") { unlink("$ImgDir$no-2$tail2"); } &UpFile2; } if ($in{'upfile3'}) { if (-e "$ImgDir$no-3$tail3") { unlink("$ImgDir$no-3$tail3"); } &UpFile3; } if ($in{'upfile4'}) { if (-e "$ImgDir$no-4$tail4") { unlink("$ImgDir$no-4$tail4"); } &UpFile4; } if ($in{'upfile5'}) { if (-e "$ImgDir$no-5$tail5") { unlink("$ImgDir$no-5$tail5"); } &UpFile5; } if ($in{'upfile6'}) { if (-e "$ImgDir$no-6$tail6") { unlink("$ImgDir$no-6$tail6"); } &UpFile6; } if ($in{'upfile7'}) { if (-e "$ImgDir$no-7$tail7") { unlink("$ImgDir$no-7$tail7"); } &UpFile7; } if ($in{'upfile8'}) { if (-e "$ImgDir$no-8$tail8") { unlink("$ImgDir$no-8$tail8"); } &UpFile8; } if ($in{'upfile9'}) { if (-e "$ImgDir$no-9$tail9") { unlink("$ImgDir$no-9$tail9"); } &UpFile9; } if ($in{'upfile10'}) { if (-e "$ImgDir$no-10$tail10") { unlink("$ImgDir$no-10$tail10"); } &UpFile10; } # 1件削除処理 if ($in{'delfile1'}) { if (-e "$ImgDir$no-1$tail1") { unlink("$ImgDir$no-1$tail1"); } $tail1 = ""; $W1 = ""; $H1 = ""; $in{'com1'} = ""; } if ($in{'delfile2'}) { if (-e "$ImgDir$no-2$tail2") { unlink("$ImgDir$no-2$tail2"); } $tail2 = ""; $W2 = ""; $H2 = ""; $in{'com2'} = ""; } if ($in{'delfile3'}) { if (-e "$ImgDir$no-3$tail3") { unlink("$ImgDir$no-3$tail3"); } $tail3 = ""; $W3 = ""; $H3 = ""; $in{'com3'} = ""; } if ($in{'delfile4'}) { if (-e "$ImgDir$no-4$tail4") { unlink("$ImgDir$no-4$tail4"); } $tail4 = ""; $W4 = ""; $H4 = ""; $in{'com4'} = ""; } if ($in{'delfile5'}) { if (-e "$ImgDir$no-5$tail5") { unlink("$ImgDir$no-5$tail5"); } $tail5 = ""; $W5 = ""; $H5 = ""; $in{'com5'} = ""; } if ($in{'delfile6'}) { if (-e "$ImgDir$no-6$tail6") { unlink("$ImgDir$no-6$tail6"); } $tail6 = ""; $W6 = ""; $H6 = ""; $in{'com6'} = ""; } if ($in{'delfile7'}) { if (-e "$ImgDir$no-7$tail7") { unlink("$ImgDir$no-7$tail7"); } $tail7 = ""; $W7 = ""; $H7 = ""; $in{'com7'} = ""; } if ($in{'delfile8'}) { if (-e "$ImgDir$no-8$tail8") { unlink("$ImgDir$no-8$tail8"); } $tail8 = ""; $W8 = ""; $H8 = ""; $in{'com8'} = ""; } if ($in{'delfile9'}) { if (-e "$ImgDir$no-9$tail9") { unlink("$ImgDir$no-9$tail9"); } $tail9 = ""; $W9 = ""; $H9 = ""; $in{'com9'} = ""; } if ($in{'delfile10'}) { if (-e "$ImgDir$no-10$tail10") { unlink("$ImgDir$no-10$tail10"); } $tail10 = ""; $W10 = ""; $H10 = ""; $in{'com10'} = ""; } $_ = "$no<>$in{'year1'}<>$in{'month1'}<>$in{'day1'}<>$in{'year2'}<>$in{'month2'}<>$in{'day2'}<>$in{'sub'}<>$tail1<>$W1<>$H1<>$in{'com1'}<>$tail2<>$W2<>$H2<>$in{'com2'}<>$tail3<>$W3<>$H3<>$in{'com3'}<>$tail4<>$W4<>$H4<>$in{'com4'}<>$tail5<>$W5<>$H5<>$in{'com5'}<>$tail6<>$W6<>$H6<>$in{'com6'}<>$tail7<>$W7<>$H7<>$in{'com7'}<>$tail8<>$W8<>$H8<>$in{'com8'}<>$tail9<>$W9<>$H9<>$in{'com9'}<>$tail10<>$W10<>$H10<>$in{'com10'}<>$host<>\n"; } } if ($in{'action'} eq "edit") { push(@new,$_); } } close(IN); if (!$flag) { &error("該当の記事が見当たりません"); } $check = &decrypt("$in{'pwd'}", "$pw2"); if ($in{'pwd'} ne $pass) { &error("PASSが違います"); } if ($in{'action'} eq "edit") { if ($in{'pastlog'} eq "") { unshift(@new,$top); open(OUT,">$logfile") || &error("Open Error : $logfile"); } else { open(OUT,">$pastdir$in{'pastlog'}.log") || &error("Open Error : $pastdir$in{'pastlog'}.log"); } print OUT @new; close(OUT); &unlock if ($lockkey); &set_cookie; &header; print "
 + 修正が完了しました + 

\n"; print "
\n"; print "
\n"; print "\n\n"; exit; } $com1 =~ s/
/\r/g; $com1 =~ s/<(?:[^>'"]*|(['"]).*\1)*>//gs; $com2 =~ s/
/\r/g; $com2 =~ s/<(?:[^>'"]*|(['"]).*\1)*>//gs; $com3 =~ s/
/\r/g; $com3 =~ s/<(?:[^>'"]*|(['"]).*\1)*>//gs; $com4 =~ s/
/\r/g; $com4 =~ s/<(?:[^>'"]*|(['"]).*\1)*>//gs; $com5 =~ s/
/\r/g; $com5 =~ s/<(?:[^>'"]*|(['"]).*\1)*>//gs; $com6 =~ s/
/\r/g; $com6 =~ s/<(?:[^>'"]*|(['"]).*\1)*>//gs; $com7 =~ s/
/\r/g; $com7 =~ s/<(?:[^>'"]*|(['"]).*\1)*>//gs; $com8 =~ s/
/\r/g; $com8 =~ s/<(?:[^>'"]*|(['"]).*\1)*>//gs; $com9 =~ s/
/\r/g; $com9 =~ s/<(?:[^>'"]*|(['"]).*\1)*>//gs; $com10 =~ s/
/\r/g; $com10 =~ s/<(?:[^>'"]*|(['"]).*\1)*>//gs; &header; print "\n"; print "\n"; print "
\n"; print "<< back\n"; print "
\n"; print "
 + 変更する部分のみ修正して送信ボタンを押して下さい + 

\n"; print "画像に関しては、下にサムネイルで表\示しているものがサーバにあります。
\n"; print "変更がない場合は、何もいれずにそのまま送信してください。
\n"; print "変更する場合のみ、FILE*を選択してください。
\n"; &form("edit",$no,$year1,$month1,$day1,$year2,$month2,$day2,$sub,$tail1,$W1,$H1,$com1,$tail2,$W2,$H2,$com2,$tail3,$W3,$H3,$com3,$tail4,$W4,$H4,$com4,$tail5,$W5,$H5,$com5,$tail6,$W6,$H6,$com6,$tail7,$W7,$H7,$com7,$tail8,$W8,$H8,$com8,$tail9,$W9,$H9,$com9,$tail10,$W10,$H10,$com10,$host); print "\n\n"; exit; } #------------------------# # フォーム入力チェック # #------------------------# sub form_check { # 他サイトからのアクセスを排除 if ($base_url) { $ref = $ENV{'HTTP_REFERER'}; $ref =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($ref !~ /$base_url/i) { &error("不正なアクセスです"); } } } #--------------# # 時間を取得 # #--------------# sub get_time { $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); $mon2 = $mon + 1; $week = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat') [$wday]; $hour = sprintf("%02d",$hour);$min = sprintf("%02d",$min); $sysdate = "$syear/$smonth/$sday($week) $hour:$min"; $sysday = "$syear / $mon2 / $mday  ($week)"; $sysdate2 = "$syear$smonth$sday"; if ( $initdisp == 1 ) { $iday = time + 86400 * (-1); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($iday); $syear = sprintf("%02d",$year + 1900);$smonth = sprintf("%02d",$mon + 1);$sday = sprintf("%02d",$mday); } $cyear = 1989; $cday = 365; ($sec,$min,$hour,$day,$mon,$year,$wday)= localtime; $day = ''; $year = $in{'year'}; $mon = $in{'month'}; $day = $in{'day'}; $mon = sprintf("%02d",$mon); # 日時のフォーマット $date = sprintf("%04d/%02d/%02d(%s) %02d:%02d", $year+1900,$mon2,$mday,$week[$wday],$hour,$min); } #----------------# # カウンタ処理 # #----------------# sub counter { # 閲覧時のみカウントアップ if ($mode eq '') { $cntup=1; } else { $cntup=0; } # カウントファイルを読みこみ open(IN,"$cntfile") || &error("Open Error : $cntfile"); eval "flock(IN, 1);"; $data = ; close(IN); # IPチェックとログ破損チェック ($cnt, $ip) = split(/:/, $data); if ($addr eq "$ip" || $cnt eq "") { $cntup=0; } # カウントアップ if ($cntup) { $cnt++; open(OUT,"+< $cntfile") || &error("Write Error : $cntfile"); eval "flock(OUT, 2);"; truncate(OUT, 0); seek(OUT, 0, 0); print OUT "$cnt\:$addr"; close(OUT); } # 桁数調整 while(length($cnt) < $mini_fig) { $cnt = '0' . $cnt; } @cnts = split(//, $cnt); # GIFカウンタ表示 if ($counter == 2) { foreach (0 .. $#cnts) { print "\"$cnts[$_]\""; } } # テキストカウンタ表示 else { print "$cnt\n"; } } #--------------# # ロック処理 # #--------------# sub lock { # 1分以上古いロックは削除する if (-e $lockfile) { local($mtime) = (stat($lockfile))[9]; if ($mtime < time - 60) { &unlock; } } local($retry) = 5; # symlink関数式ロック if ($lockkey == 1) { while (!symlink(".", $lockfile)) { if (--$retry <= 0) { &error('LOCK is BUSY'); } sleep(1); } # mkdir関数式ロック } elsif ($lockkey == 2) { while (!mkdir($lockfile, 0755)) { if (--$retry <= 0) { &error('LOCK is BUSY'); } sleep(1); } } $lockflag=1; } #--------------# # ロック解除 # #--------------# sub unlock { if ($lockkey == 1) { unlink($lockfile); } elsif ($lockkey == 2) { rmdir($lockfile); } $lockflag=0; } #----------------------# # パスワード暗号処理 # #----------------------# sub encrypt { local($inpw) = $_[0]; local(@SALT, $salt, $encrypt); @SALT = ('a'..'z', 'A'..'Z', '0'..'9', '.', '/'); srand; $salt = $SALT[int(rand(@SALT))] . $SALT[int(rand(@SALT))]; $encrypt = crypt($inpw, $salt) || crypt ($inpw, '$1$' . $salt); return $encrypt; } #----------------------# # パスワード照合処理 # #----------------------# sub decrypt { local($inpw, $logpw) = @_; local($salt, $key, $check); $salt = $logpw =~ /^\$1\$(.*)\$/ && $1 || substr($logpw, 0, 2); $check = "no"; if (crypt($inpw, $salt) eq $logpw || crypt($inpw, '$1$' . $salt) eq $logpw) { $check = "yes"; } return $check; } #------------------# # HTMLのヘッダー # #------------------# sub header { $head_flag=1; print "Content-type: text/html\n\n"; print <<"EOM"; $title EOM if ($kotei) { print "\n"; } else { print "\n"; } if ($bgsnd) { print "\n"; } if ($tps) { $tpw = "style=\"filter:Alpha(opacity=$tp)\""; } else { $tpw =""; } } #-----------------# # 自動URLリンク # #-----------------# sub auto_link { $_[0] =~ s/([^=^\"]|^)(http\:[\w\.\~\-\/\?\&\+\=\:\@\%\;\#\%]+)/$1$2<\/a>/g; } #----------------# # ホスト名取得 # #----------------# sub get_host { $host = $ENV{'REMOTE_HOST'}; $addr = $ENV{'REMOTE_ADDR'}; if ($host eq "" || $host eq $addr) { $host = gethostbyaddr(pack("C4", split(/\./, $addr)), 2) || $addr; } } #----------------# # 過去ログ生成 # #----------------# sub pastlog { local($past_flag)=0; if ($tps) { $tpw = "style=\"filter:Alpha(opacity=$tp)\""; } else { $tpw =""; } # 過去NOを開く open(NO,"$nofile") || &error("Open Error : $nofile"); $count = ; close(NO); # 過去ログのファイル名を定義 $pastfile = "$pastdir$count\.log"; # 過去ログを開く open(IN,"$pastfile") || &error("Open Error : $pastfile"); @past = ; close(IN); # 規定の行数をオーバーすると次ファイルを自動生成 if ($#past > $log_line) { $past_flag=1; # カウントファイル更新 $count++; open(NO,">$nofile") || &error("Write Error : $nofile"); print NO $count; close(NO); $pastfile = "$pastdir$count\.log"; @past=(); } @temp=(); foreach (@data) { ($pno,$pyear1,$pmonth1,$pday1,$pyear2,$pmonth2,$pday2,$psub,$ptail1,$pW1,$pH1,$pcom1,$ptail2,$pW2,$pH2,$pcom2,$ptail3,$pW3,$pH3,$pcom3,$ptail4,$pW4,$pH4,$pcom4,$ptail5,$pW5,$pH5,$pcom5,$ptail6,$pW6,$pH6,$pcom6,$ptail7,$pW7,$pH7,$pcom7,$ptail8,$pW8,$pH8,$pcom8,$ptail9,$pW9,$pH9,$pcom9,$ptail10,$pW10,$pH10,$pcom10,$phost) = split(/<>/); # 保存記事をフォーマット push(@temp,"$pno<>$pyear1<>$pmonth1<>$pday1<>$pyear2<>$pmonth2<>$pday2<>$psub<>$ptail1<>$pW1<>$pH1<>$pcom1<>$ptail2<>$pW2<>$pH2<>$pcom2<>$ptail3<>$pW3<>$pH3<>$pcom3<>$ptail4<>$pW4<>$pH4<>$pcom4<>$ptail5<>$pW5<>$pH5<>$pcom5<>$ptail6<>$pW6<>$pH6<>$pcom6<>$ptail7<>$pW7<>$pH7<>$pcom7<>$ptail8<>$pW8<>$pH8<>$pcom8<>$ptail9<>$pW9<>$pH9<>$pcom9<>$ptail10<>$pW10<>$pH10<>$pcom10<>$phost<>\n"); } # 過去ログを更新 unshift(@past,@temp); open(OUT,">$pastfile") || &error("Write Error : $pastfile"); print OUT @past; close(OUT); if ($past_flag) { chmod(0666,$pastfile); } } #------------# # 過去ログ # #------------# sub past { local($wh,$i,$flag); # ヘッダを出力 &header; # タイトル部 print "
\n"; if ($banner1 ne "") { print "$banner1

\n"; } if ($t_img eq '') { print "$title\n"; } else { print "\"$title\"\n"; } if ($in{'action'} eq "view") { print "\n"; print "\n"; print "
\n"; print "<< back \n"; print "
\n"; } # メニュー部 print "

\n"; open(IN,"$nofile") || &error("Open Error : $nofile"); $pastno = ; close(IN); if (!$in{'pastlog'}) { $in{'pastlog'} = $pastno; } $i=0; $fullpic=0; #ログ表示 if ($in{'action'} eq "view") { # 表示ログを定義 $in{'pastlog'} =~ s/\D//g; $file = "$pastdir$in{'pastlog'}\.log"; open(IN,"$file") || &error("Open Error : $file"); while () { ($no,$year1,$month1,$day1,$year2,$month2,$day2,$sub,$tail1,$W1,$H1,$com1,$tail2,$W2,$H2,$com2,$tail3,$W3,$H3,$com3,$tail4,$W4,$H4,$com4,$tail5,$W5,$H5,$com5,$tail6,$W6,$H6,$com6,$tail7,$W7,$H7,$com7,$tail8,$W8,$H8,$com8,$tail9,$W9,$H9,$com9,$tail10,$W10,$H10,$com10,$host) = split(/<>/); # 題名の長さ if (length($sub) > $sub_len*2) { $sub = substr($sub,0,$sub_len*2); $sub .= "..."; } if ($month1 < 10) { $month1 = "0$month1"; } if ($day1 < 10) { $day1 = "0$day1"; } if ($month2 < 10) { $month2 = "0$month2"; } if ($day2 < 10) { $day2 = "0$day2"; } if ($in{'no'} == $no) { print "\n"; print "
\n"; if ($tail1 ne "") { print "\"photo1\"\n"; $fullpic = 1; } if ($tail2 ne "") { print "  \"photo2\"\n"; $fullpic = 2; } if ($tail3 ne "") { print "  \"photo3\"\n"; $fullpic = 3; } if ($tail4 ne "") { print "  \"photo4\"\n"; $fullpic = 4; } if ($tail5 ne "") { print "  \"photo5\"\n"; $fullpic = 5; } if ($tail6 ne "") { print "  \"photo6\"\n"; $fullpic = 6; } if ($tail7 ne "") { print "  \"photo7\"\n"; $fullpic = 7; } if ($tail8 ne "") { print "  \"photo8\"\n"; $fullpic = 8; } if ($tail9 ne "") { print "  \"photo9\"\n"; $fullpic = 9; } if ($tail10 ne "") { print "  \"photo10\"\n"; $fullpic = 10; } $comno = "com$in{'photono'}"; if ($in{'photono'} == 1) { $backphoto = $fullpic; $backtail = "tail$fullpic"; $backW = "W$fullpic"; $backH = "H$fullpic"; } else { $backphoto = $in{'photono'}-1; $backtail = "tail$backphoto"; $backW = "W$backphoto"; $backH = "H$backphoto"; } if ($in{'photono'} == $fullpic) { $nextphoto = 1; $nexttail = "tail1"; $nextW = "W1"; $nextH = "H1"; } else { $nextphoto = $in{'photono'}+1; $nexttail = "tail$nextphoto"; $nextW = "W$nextphoto"; $nextH = "H$nextphoto"; } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\"photo$in{'photono'}\"\n"; print "
\n"; print "    $sub\n"; print "

\n"; print "
$year1/$month1/$day1 〜 $year2/$month2/$day2   
\n"; print "
\n"; print "
photo no.$in{'photono'} / $fullpic   
\n"; print "<< \n"; print " \n"; print ">>  

\n"; print "
comment   
"; print "
$$comno
\n"; print "

\n"; print "
\n"; print "
\n"; print "  
+ROCO ALBUM+   
\n"; print "KENT , UG   
\n"; print "
\n"; } } close(IN); } else { print "
過去ログモードです。
\n"; print "\n"; print "\n"; print "\n\n"; if ($in{'action'} eq "view") { print "\n"; } else { print "
\n"; } print "\n"; print "
<< back\n"; print "
\n"; print "\n"; # 表示ログを定義 $in{'pastlog'} =~ s/\D//g; $file = "$pastdir$in{'pastlog'}\.log"; open(IN,"$file") || &error("Open Error : $file"); while () { ($no,$year1,$month1,$day1,$year2,$month2,$day2,$sub,$tail1,$W1,$H1,$com1,$tail2,$W2,$H2,$com2,$tail3,$W3,$H3,$com3,$tail4,$W4,$H4,$com4,$tail5,$W5,$H5,$com5,$tail6,$W6,$H6,$com6,$tail7,$W7,$H7,$com7,$tail8,$W8,$H8,$com8,$tail9,$W9,$H9,$com9,$tail10,$W10,$H10,$com10,$host,$color,$color2) = split(/<>/); $i++; # 題名の長さ if (length($sub) > $sub_len*2) { $sub = substr($sub,0,$sub_len*2); $sub .= "..."; } if ($month1 < 10) { $month1 = "0$month1"; } if ($day1 < 10) { $day1 = "0$day1"; } if ($month2 < 10) { $month2 = "0$month2"; } if ($day2 < 10) { $day2 = "0$day2"; } print "\n"; print "\n"; print "\n"; print "\n"; } close(IN); print "
collected works of art clay studio
$year1/$month1/$day1〜$year2/$month2/$day2$sub
\n"; } #新着表示終わり #記事修正ダイアログ if ($in{'action'} ne "view") { print "\n"; print "\n"; print "
past >>\n" if ($pastkey); print "
\n"; print "

\n"; print "
\n"; print "\n"; print "
+admin+
\n"; print "\n"; print "
\n"; print "\n"; # 表示ログを定義 $in{'pastlog'} =~ s/\D//g; $file = "$pastdir$in{'pastlog'}\.log"; open(IN,"$file") || &error("Open Error : $file"); print "\n"; print "PASS \n"; print "  
\n"; print "
\n"; } # 著作権表示部 # 削除改変を禁止します if ($in{'action'} eq "") { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$banner2
++ ROCO ALBUM ++
KENT , UG
\n"; } print "\n\n\n"; exit; } #------------------# # チェックモード # #------------------# sub check { &header; print "

Check Mode

\n"; print "
    \n"; # ログパス if (-e $logfile) { print "
  • ログファイルのパス:OK\n"; # パーミッション if (-r $logfile && -w $logfile) { print "
  • ログファイルのパーミッション:OK\n"; } else { print "
  • ログファイルのパーミッション:NG\n"; } } else { print "
  • ログファイルのパス:NG → $logfile\n"; } # カウンタログ print "
  • カウンタ:"; if ($counter) { print "設定あり\n"; if (-e $cntfile) { print "
  • カウンタログファイルのパス:OK\n"; } else { print "
  • カウンタログファイルのパス:NG → $cntfile\n"; } } else { print "設定なし\n"; } # ロックディレクトリ print "
  • ロック形式:"; if ($lockkey == 0) { print "ロック設定なし\n"; } else { if ($lockkey == 1) { print "symlink\n"; } else { print "mkdir\n"; } ($lockdir) = $lockfile =~ /(.*)[\\\/].*$/; print "
  • ロックディレクトリ:$lockdir\n"; if (-d $lockdir) { print "
  • ロックディレクトリのパス:OK\n"; if (-r $lockdir && -w $lockdir && -x $lockdir) { print "
  • ロックディレクトリのパーミッション:OK\n"; } else { print "
  • ロックディレクトリのパーミッション:NG → $lockdir\n"; } } else { print "
  • ロックディレクトリのパス:NG → $lockdir\n"; } } # 画像ディレクトリ print "
  • 画像ディレクトリ:$ImgDir\n"; if (-d $ImgDir) { print "
  • 画像ディレクトリのパス:OK\n"; if (-r $ImgDir && -w $ImgDir && -x $ImgDir) { print "
  • 画像ディレクトリのパーミッション:OK\n"; } else { print "
  • 画像ディレクトリのパーミッション:NG → $ImgDir\n"; } } else { print "
  • 画像ディレクトリ:NG → $ImgDir\n"; } # 過去ログ print "
  • 過去ログ:"; if ($pastkey == 0) { print "設定なし\n"; } else { print "設定あり\n"; # NOファイル if (-e $nofile) { print "
  • NOファイルパス:OK\n"; if (-r $nofile && -w $nofile) { print "
  • NOファイルパーミッション:OK\n"; } else { print "
  • NOファイルパーミッション:NG → $nofile\n"; } } else { print "
  • NOファイルのパス:NG → $nofile\n"; } # ディレクトリ if (-d $pastdir) { print "
  • 過去ログディレクトリパス:OK\n"; if (-r $pastdir && -w $pastdir && -x $pastdir) { print "
  • 過去ログディレクトリパーミッション:OK\n"; } else { print "
  • 過去ログディレクトリパーミッション:NG → $pastdir\n"; } } else { print "
  • 過去ログディレクトリパーミッション:NG → $pastdir\n"; } } print "
\n\n"; exit; } #------------------# # JPEGサイズ認識 # #------------------# sub JpegSize { local($jpeg) = @_; local($t, $m, $c, $l, $W, $H); open(JPEG, "$jpeg") || return (0,0); binmode JPEG; read(JPEG, $t, 2); while (1) { read(JPEG, $t, 4); ($m, $c, $l) = unpack("a a n", $t); if ($m ne "\xFF") { $W = $H = 0; last; } elsif ((ord($c) >= 0xC0) && (ord($c) <= 0xC3)) { read(JPEG, $t, 5); ($H, $W) = unpack("xnn", $t); last; } else { read(JPEG, $t, ($l - 2)); } } close(JPEG); return ($W, $H); } #-----------------# # GIFサイズ認識 # #-----------------# sub GifSize { local($gif) = @_; local($data); open(GIF,"$gif") || return (0,0); binmode(GIF); sysread(GIF,$data,10); close(GIF); if ($data =~ /^GIF/) { $data = substr($data,-4); } $W = unpack("v",substr($data,0,2)); $H = unpack("v",substr($data,2,2)); return ($W, $H); } #-----------------# # PNGサイズ認識 # #-----------------# sub PngSize { local($png) = @_; local($data); open(PNG, "$png") || return (0,0); binmode(PNG); read(PNG, $data, 24); close(PNG); $W = unpack("N", substr($data, 16, 20)); $H = unpack("N", substr($data, 20, 24)); return ($W, $H); } #-----------------# # URLエンコード # #-----------------# sub url_enc { local($_) = @_; s/(\W)/'%' . unpack('H2', $1)/eg; s/\s/+/g; $_; } #----------------# # 投稿フォーム # #----------------# sub form { local($type,$no,$year1,$month1,$day1,$year2,$month2,$day2,$sub,$tail1,$W1,$H1,$com1,$tail2,$W2,$H2,$com2,$tail3,$W3,$H3,$com3,$tail4,$W4,$H4,$com4,$tail5,$W5,$H5,$com5,$tail6,$W6,$H6,$com6,$tail7,$W7,$H7,$com7,$tail8,$W8,$H8,$com8,$tail9,$W9,$H9,$com9,$tail10,$W10,$H10,$com10,$host,$i) = @_; if ($type ne "edit") { if ($in{'pwd'} ne $pass) {&error("PASSが違います。"); } } if ($type ne "edit") { &header; } &get_time; print "
\n"; if ($type ne "edit") { print "\n"; print "\n"; print "
\n"; print "<< back\n"; print "
\n"; print "
Please write great recollections.
\n"; print "
\n"; } # フォーム種別を判別 if ($type eq "edit") { print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } else { print "\n"; print "\n"; &get_cookie; } print <<"EOM";
EOM #開始日 print "\n"; print <<"EOM"; EOM if ($type eq "edit") { print " EOM if ($type eq "edit") { print "\n"; } print <<"EOM"; EOM if ($type eq "edit") { print "\n"; } print <<"EOM"; EOM if ($type eq "edit") { print "\n"; } print <<"EOM"; EOM if ($type eq "edit") { print "\n"; } print <<"EOM"; EOM if ($type eq "edit") { print "\n"; } print <<"EOM"; EOM if ($type eq "edit") { print "\n"; } print <<"EOM"; EOM if ($type eq "edit") { print "\n"; } print <<"EOM"; EOM if ($type eq "edit") { print "\n"; } print <<"EOM"; EOM if ($type eq "edit") { print "\n"; } print <<"EOM"; EOM if ($type eq "edit") { print "\n"; } print <<"EOM"; EOM if ($type eq "edit") { print "\n"; } print "
DATE 年\n"; print " 月\n"; print " 日\n"; print " 〜 "; #終了日 print " 年\n"; print " 月\n"; print " 日
TITLE\n"; } else { print "\n"; } print <<"EOM";
FILE1 COM del
FILE2 COM del
FILE3 COM del
FILE4 COM del
FILE5 COM del
FILE6 COM del
FILE7 COM del
FILE8 COM del
FILE9 COM del
FILE10 COM del
\n"; if (-e "$ImgDir$no-1$tail1") { print "1\n"; } if (-e "$ImgDir$no-2$tail2") { print "2\n"; } if (-e "$ImgDir$no-3$tail3") { print "3\n"; } if (-e "$ImgDir$no-4$tail4") { print "4\n"; } if (-e "$ImgDir$no-5$tail5") { print "5\n"; } if (-e "$ImgDir$no-6$tail6") { print "6\n"; } if (-e "$ImgDir$no-7$tail7") { print "7\n"; } if (-e "$ImgDir$no-8$tail8") { print "8\n"; } if (-e "$ImgDir$no-9$tail9") { print "9\n"; } if (-e "$ImgDir$no-10$tail10") { print "10\n"; } print "
"; print "
\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$banner2
++ ROCO ALBUM ++
SCRIPT : KENT , EDIT & DESIGN : UG
\n"; print "\n\n"; exit; }