#!/usr/bin/perl ############################################################################## # shiromuku(u)PET version 2.00 # Created 02/13/00 # Copyright 2000 Shiromuku # Available at http://www.t-okada.com/cgi/ ############################################################################### # COPYRIGHT NOTICE (著作権の告示) # Copyright 2000 Shiromuku All Rights Reserved. # This script can be used and modified free of charge as long as you don't # change this header or any of the parts that give me credit for writing # this. (このスクリプトは無償で使用または改変できます。ただしこの著作権の告知と上記のコメント、及びCGIにより生成されるHTML文書下部にある著作権表示部は変えないで下さい。) # By using this script you agree to indemnify me from any liability # that might arise from its use. In simple English, if this script somehow makes your computer run amuck and kill the pope, it's not my fault. (このスクリプトを使用することにより、使用者はその使用によって起こる可能性のあるいかなる事柄に対する責務についても、私Shiromukuに免責の保証を与えることに同意したものとします。) # Redistributing and selling the code for this program without prior written consent is expressly forbidden. (前もって書面での承諾を得ることなくこのプログラムのコードを再配布したり売ったりすることは 明確に禁じられています。) ####################### require './jcode.pl'; #変えないこと require './su_pet_cfg.cgi'; #変えないこと #ここから下の部分は、変更しなくて結構です。 ####################### &parse_data; print "Content-type: text/html\n"; if ($usepasscookie == 1) { &get_cookie; $c_name = $COOKIE{'name'}; $c_email = $COOKIE{'email'}; $c_url = $COOKIE{'url'}; $c_pass = $COOKIE{'pass'}; $c_username = $COOKIE{'username'}; $c_password = $COOKIE{'password'}; if ($c_url eq '') { $c_url = 'http://'; } } if ($action eq "delete_image_go_c") { &delete_image_go_c; &return_cat_suc; exit (0) ; } elsif ($action eq "download_log") { &download_log; exit (0) ; } elsif ($action eq "admin") { $txtnum = &get_number ("$section$txtnumfile", '1'); &return_admin; exit (0) ; } elsif ($action eq "admin_cat") { &return_admin_cat; exit (0) ; } elsif ($action eq "admin_enter") { &return_admin_enter; exit (0) ; } elsif ($action eq "selectadmin") { $txtnum = &get_number ("$section$txtnumfile", '1'); $txtnum = $lastnum; &show_cat; exit (0) ; } elsif ($action eq "user_a") { &user_a; exit (0) ; } elsif ($action eq "user") { &user_a; exit (0) ; } elsif ($action eq "selectadmin_cat") { &select_admin_cat; exit (0) ; } elsif ($action eq "add_cat_go") { &add_cat_go; &return_cat_suc; exit (0) ; } elsif ($action eq "remove_cat_go") { &remove_cat_go; &return_cat_suc; exit (0) ; } elsif ($action eq "change_cat_go") { &change_cat_go; &return_cat_suc; exit (0) ; } elsif ($action eq "make_pass") { &make_pass; &return_cat_suc; exit (0) ; } elsif ($action eq "changepassgo") { &changepassgo; &return_cat_suc; exit (0) ; } elsif ($action eq "show_cat") { $txtnum = &get_number ("$section$txtnumfile", '1'); &show_cat; exit (0) ; } elsif ($action eq "showlast") { $showsection = $FORM{'section'}; $txtnum = $lastnum; &show_cat; exit (0) ; } elsif ($action eq "remove") { $txtnum = &get_number ("$section$txtnumfile", '1'); &remove; &return_suc; exit (0) ; } elsif ($action eq "settei") { &settei; &return_cat_suc; exit (0) ; } elsif ($action eq "search_all_list") { $txtnum = &get_number ("$section$txtnumfile", '1'); &search_all_list; exit (0) ; } elsif ($action eq "search_all_lists") { $txtnum = &get_number ("$section$txtnumfile", '1'); &search_all_lists; exit (0) ; } &return_main; exit (0) ; ############################ sub decrement_num { my ($file) = $_[0]; my ($d_num) = $_[1]; my ($d_nums) = $d_num-1; open(FILE,">$basedir/$file") || &error("ファイルがオープンできません。\n"); &lock; print FILE "$d_nums"; &unlock; close(FILE); return $d_nums; } ############################ sub increment_catnum { $catnums = ++$catnum; open(FILE,">$basedir/$catnumfile") || die $!; &lock; print FILE "$catnums"; &unlock; close(FILE); } ############################ sub parse_data { if ($ENV{'REQUEST_METHOD'} eq "POST") { &check_referer; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; unless (($name eq "introduction") || ($name eq "title") || ($name eq "stylesheet") || ($name eq "back")) { $value =~ s///g; $value =~ s/<([^>]|\n)*>//g; $value =~ s//>/ig; } $value =~ s/\|\|\|//g; #$value =~ s/&/&/g; $value =~ s/\r\n/
/g; $value =~ s/\r/
/g; $value =~ s/\n/
/g; &jcode'convert(*value,$mycode); if ($mycode eq 'sjis') { &jcode'h2z_sjis(*value); } if ($mycode eq 'euc') { &jcode'h2z_euc(*value); } $FORM{$name} = $value; } &get_var; } } ############################ #管理用ページに入る sub return_admin_enter { &head("管理用"); if ($FORM{'cat'}){ print "
\n"; print "\n"; &id_html; print "
\n"; } if ($FORM{'show'}){ print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; &id_html; print "
\n"; } print "

\n"; &foot; } ############################ #総合管理用ページその1 sub return_admin_cat { &check_referer; &check_pass; &set_cookie; &head("カテゴリー及びパスワード管理用"); &admin_html; &foot; } ############################ #管理用ページその1 sub return_admin { &check_pass; &set_cookie; &head("管理用ページ"); &admin_htmls; &foot; } ############################ #カテゴリー管理用ページその2 sub select_admin_cat { &check_pass; if ($FORM{'file_upload'}){ &head("デザイン設定用画像ファイルのアップロード"); print "


\n"; &show_files; print "
画像ファイルを選んで下さい。
\n"; print "
\n"; print "
\n"; print "


\n"; print "
\n"; &id_html; print "
\n"; print "
\n"; &foot; } if ($FORM{'delete_image'}){ &head("ファイルの削除"); print "


\n"; &show_files; print "
\n"; &id_html; print "\n"; print "
\n"; print "\n"; print "
削除するデザイン設定用画像を選んで下さい。

\n"; print "
\n"; print "
\n"; print "


\n"; &foot; } if ($FORM{'settei'}){ &open_config; if ($t_width eq '') { $t_width="70%"; } if ($image eq '') { $image="http://"; } if ($bkgd_img eq '') { $bkgd_img="http://"; } if ($line_url eq '') { $line_url="http://"; } if ($icon_url eq '') { $icon_url="http://"; } $back =~ s/
/\n/g; $title =~ s/
/\n/g; $introduction =~ s/
/\n/g; $stylesheet =~ s/
/\n/g; &head("デザインの設定をする"); print "


\n"; &show_files; 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 "\n"; print "\n"; print "\n"; if ($use_stylesheet==1) { print "\n"; } print "
ペット紹介コーナーのタイトル

ペット紹介コーナーのタイトル部分
HTMLのタグを使って自由にご記入できます。
背景画像のURL
省略可
区切り線画像のURL
省略可
アイコン画像のURL
省略可
背景色
記事のTABLEの色
色をつけない場合は未記入にすること
記事のTABLEの幅
記事のタイトルの「色・大きさ・フォントの種類」
(例:SIZE=3 COLOR=black)COLORのみ指定も可、半角英数字で記入のこと、色名と大きさは\"\"でくくらなくても良い
記事の文字の「色・大きさ・フォントの種類」
(例:SIZE=3 COLOR=black)COLORのみ指定も可、半角英数字で記入のこと、色名と大きさは\"\"でくくらなくても良い
記事以外の文字の色
リンクの色
上部に入れたい言葉・画像など
HTMLのタグを使って自由にご記入できます。
下部に入れたい言葉・画像など(戻り先など)
HTMLのタグを使って自由にご記入できます。
スタイルシートの記述
HTMLのタグを使って自由にご記入できます。


\n"; &id_html; print "


\n"; print "
\n"; print "\n"; &foot; } if ($FORM{'add_cat'}){ &check_pass; &set_cookie; &head("カテゴリーの追加"); print "
\n"; print "\n"; print "
\n"; print "\n"; print "
追加したいカテゴリー名


カテゴリーの説明
\n"; print "

\n"; &id_html; print "
\n"; print "
\n"; print "\n"; &foot; } if ($FORM{'remove_cat'}){ &check_pass; &set_cookie; &head("カテゴリーの削除"); print "

注意

カテゴリーを削除するとそこに含まれるレシピも同時に削除されます。
\n"; print "
\n"; &id_html; print "\n"; print "
\n"; print "\n"; open(FILE,"<$basedir/$catfile") || die $!; &lock; @cfile = ; &unlock; close(FILE); foreach (sort @cfile) { ($mark,$section,$cat_name_j,$cat_descrip,$newdate,$markend,$last)=split(/\|\|\|/,$_); print "\n"; } print "
下から選んで下さい
$cat_name_j
\n"; print "
\n"; print "
\n"; &foot; } if ($FORM{'change_cat'}){ &check_pass; &set_cookie; open(FILE,"<$basedir/$catfile") || die $!; &lock; @cfile = ; &unlock; close(FILE); &head("カテゴリーの名前と説明の修正"); foreach (sort @cfile) { ($mark,$section,$cat_name_j,$cat_descrip,$newdate,$markend,$last)=split(/\|\|\|/,$_); print "
\n"; print "\n"; print "\n"; &id_html; print "
\n"; print "\n"; print "
カテゴリー名

カテゴリーの説明
\n"; $cat_descrip =~ s/
/\n/g; print "

\n"; print "
\n"; print "
\n"; print "\n"; print "

\n"; print "


\n"; print "

\n"; } &foot; } if ($FORM{'changepass'}){ &head("パスワードの変更"); print "

旧と新のパスワードおよびIDを入力して下さい。
\n"; print "
\n"; print "\n"; print "

旧ユーザID
\n"; print "

旧パスワード
\n"; print "

新ユーザID
\n"; print "

新パスワード
\n"; print "
\n"; print "
\n"; } } ############################ #設定 sub settei { &check_pass; &set_cookie; if ($bkgd_img !~ /^(f|ht)tp:\/\/.+\...+.*\.(jpg|bmp|gif|jpeg|JPG|JPEG|GIF)/) {$bkgd_img = ""; } if ($line_url !~ /^(f|ht)tp:\/\/.+\...+.*\.(jpg|bmp|gif|jpeg|JPG|JPEG|GIF)/) {$line_url = ""; } if ($icon_url !~ /^(f|ht)tp:\/\/.+\...+.*\.(jpg|bmp|gif|jpeg|JPG|JPEG|GIF)/) {$icon_url = ""; } $image =~ s/"/"/g; $d_title_color =~ s/"/"/g; $title_color =~ s/"/"/g; open(FILE,">$basedir/$setteifile") || die $!; &lock; print FILE "settei|||$back|||$title|||$image|||$bkgd_img|||$line_url|||$icon_url|||$bgcolor|||$title_color|||$text_color|||$link_color|||$introduction|||$d_title_color|||$i_color|||$table_color|||$stylesheet|||$t_width|||end|||\n"; &unlock; close(FILE); } ############################ #設定用画像ファイルの削除 sub delete_image_go_c { &check_pass; unlink "$c_basedir_h/$img_url"; } ############################ #カテゴリーの追加 sub add_cat_go { &check_pass; &set_cookie; $catnum = &get_number ($catnumfile, '10'); open(FILE,"<$basedir/$catfile") || &error("ファイルがオープンできません。\n"); &lock; @cfile = ; &unlock; close(FILE); $cfile = @cfile; foreach (@cfile) { ($mark,$sectionm,$cat_name_jm,$cat_descripm,$newdatem,$markend,$last)=split(/\|\|\|/,$_); if ($cat_name_j eq $cat_name_jm) { &error("そのカテゴリーはすでにあります。\n"); } } $new_section = "$catnum"; open(FILE,">>$basedir/$catfile") || die $!; &lock; print FILE "cat|||$new_section|||$cat_name_j|||$cat_descrip||||||end|||\n"; &unlock; close(FILE); $txtnum = &get_number ("$new_section$txtnumfile", '1'); $num = &get_number ("$new_section$numfile", '0'); open(FILE,">$basedir/$new_section$txtnum\.txt") || &error("ファイルがオープンできません。\n"); &lock; &unlock; close(FILE); &increment_catnum; } ############################ #カテゴリーの削除 sub remove_cat_go { $removesection = $FORM{'removesection'}; if ($removesection eq '') { &error("削除が出来ません。\n"); } &check_pass; &set_cookie; open(FILE,"<$basedir/$catfile") || &error("ファイルがオープンできません。\n"); &lock; @cfile = ; &unlock; close(FILE); open (FILE,">$basedir/$catfile"); &lock; foreach (@cfile) { ($mark,$section,$cat_name_j,$cat_descrip,$newdate,$markend,$last)=split(/\|\|\|/,$_); if (!($removesection eq $section)) { print FILE "$_"; } } &unlock; close (FILE); $txtnum = &get_number ("$removesection$txtnumfile", '1'); while ($txtnum >= 1) { open(FILE,"<$basedir/$removesection$txtnum\.txt") || &error("ファイルがオープンできません。\n"); &lock(FILE); @afile = ; &unlock(FILE); close(FILE); foreach (@afile) { ($markm,$datem,$timem,$replydatem,$replytimem,$namem,$emailm,$url_titlem,$urlm,$sectionm,$subjectm,$descripm,$picture_urlm,$materialm,$markendm,$lastm)=split(/\|\|\|/,$_); unlink "$basedir_h/$picture_urlm"; } $txtnum = $txtnum-1; @afile = (); } unlink "$basedir/$removesection$numfile"; unlink "$basedir/$removesection$txtnumfile"; unlink glob ("$basedir/$removesection*.txt"); } ############################ #カテゴリーの説明の修正 sub change_cat_go { &check_pass; &set_cookie; open(FILE,"<$basedir/$catfile") || &error("ファイルがオープンできません。\n"); &lock; @cfile = ; &unlock; close(FILE); open (FILE,">$basedir/$catfile"); &lock; foreach (@cfile) { ($markm,$sectionm,$cat_name_jm,$cat_descripm,$newdatem,$markend,$last)=split(/\|\|\|/,$_); if (!($section eq $sectionm)) { print FILE "$_"; } else { print FILE "$markm|||$section|||$cat_name_j|||$cat_descrip|||$newdate|||end|||\n"; } } &unlock; close (FILE); } ############################ #パスワード変更 sub changepassgo { $username = $FORM{oldUser}; $password = $FORM{oldPass}; &check_pass; if ((!$FORM{newUser}) || ($FORM{newUser} eq "" ) || ($FORM{newUser} !~ /\w+/)) { &error("ID・パスワードに間違いがあります。\n"); } if ((!$FORM{newPass}) || ($FORM{newPass} eq "") || ($FORM{newPass} !~ /\w+/)) { &error("ID・パスワードに間違いがあります。\n"); } $new_pass = &crypt ($FORM{newPass}, 'aa'); open(PASSWORD,">$basedir/$passfile") || &error("ファイルがオープンできません。\n"); print PASSWORD "$FORM{newUser}:$new_pass\n"; close(PASSWORD); $username = $FORM{newUser}; $password = $FORM{newPass}; &set_cookie; } ############################ #パスワードの設定 sub make_pass { $filename = "$basedir/$passfile"; if (-e $filename) { &error("エラーです。アクセスできません。\n"); } else { if ((!$FORM{username}) || ($FORM{username} eq "" ) || ($FORM{username} !~ /\w+/)) { &error("IDに間違いがあります。\n"); } if ((!$FORM{password}) || ($FORM{password} eq "") || ($FORM{password} !~ /\w+/)) { &error("パスワードに間違いがあります。\n"); } $new_pass = &crypt ($password, 'aa'); open(PASSWORD,">$basedir/$passfile") || &error("ファイルがオープンできません。\n"); print PASSWORD "$username:$new_pass\n"; close(PASSWORD); #$p_filename = "$basedir/$passfile"; #chmod 0600, $p_filename; &set_cookie; } } ############################ #削除の処理 sub remove{ if (!$type) { &check_pass; } if ($type) { $replydate = &crypt ($replydate, 'aa'); } $removedate = "$date|||$time"; open(FILE,"<$basedir/$section$lastnum\.txt") || &error("ファイルがオープンできません。\n"); &lock; @afile = ; &unlock; close(FILE); open (FILE,">$basedir/$section$lastnum\.txt"); &lock; foreach (@afile) { ($mark,$date,$time,$replydatem,$replytime,$name,$email,$url_title,$url,$sections,$subject,$descrip,$picture_urlm,$material,$markend,$last)=split(/\|\|\|/,$_); if (!(($removedate eq "$date|||$time") && ($replydate eq $replydatem))) { print FILE "$_"; } } &unlock; close (FILE); $txtnum = &get_number ("$section$txtnumfile", '1'); if ($lastnum == $txtnum) { $d_num = @afile; $d_num = $d_num - 1; if ($d_num == 0) { if ($lastnum != 1) { $txtnum = &decrement_num ("$section$txtnumfile",$txtnum); $lastnum = $txtnum; } } } unlink "$basedir_h/$picture_url"; } ############################ #メインページ sub return_main { $filename = "$basedir/$passfile"; if (-e $filename) { &open_config; if ($t_width eq '') { $t_width="70%"; } $image =~ s/"/"/g; $d_title_color =~ s/"/"/g; $title_color =~ s/"/"/g; open(FILE,"<$basedir/$catfile"); &lock; @ccfile = ; &unlock; close(FILE); &head_html; if (@ccfile) { print "

\n"; foreach (sort @ccfile) { ($mark,$section,$cat_name_j,$cat_descrip,$newdate,$markend,$last)=split(/\|\|\|/,$_); $nums = &get_number ("$section$numsfile", '未登録'); print "\n"; print "\n"; &get_date; if ($nums eq $date) { $nums = "Today"; } print "\n"; } print "
\n"; print "
\n"; print "\n"; print "\n"; print "
${cat_descrip}(${nums})
\n"; print "

\n"; print "
\n"; print "
\n"; print "\n"; &search_html; 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 "\n"; &add_html; print "
カテゴリー
修正・削除用パスワード(半角英数字10文字まで)
\n"; print "
\n"; print "

\n"; print "

\n"; } print "
$back
\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "
\n"; print "shiromuku(u)PET $version
\n"; if ($show_ads==1) { print "
$adsbanner_bottom
"; } print "\n"; } else { open(FILE,">>$basedir/$catfile") || die $!; &lock; &unlock; close(FILE); &head("管理用ページ"); print "

IDとパスワードの設定をする

\n"; print "
まず最初にIDとパスワードの設定をして下さい
\n"; print "
\n"; print "\n"; print "\n"; print "
ユーザID(半角英数字で8文字以内にして下さい。)
\n"; print "
パスワード(半角英数字で8文字以内にして下さい。)
\n"; print "


\n"; print "
\n"; print "\n"; exit; } } ############################ #ログの保存 sub download_log{ $showsection = $FORM{'section'}; open(FILE,"<$basedir/$showsection$lastnum\.txt") || &error("ファイルがオープンできません。\n"); &lock; @afile = ; &unlock; close(FILE); open(FILE,"<$basedir/$catfile"); &lock; @cfile = ; &unlock; close(FILE); print "\n"; print "\n"; print "\n"; print "\n"; print "Log\n"; print "\n"; foreach (@cfile) { ($mark,$section,$cat_name_j,$cat_descrip,$newdate,$markend,$last)=split(/\|\|\|/,$_); if ($showsection eq $section) { &jcode'convert(*cat_name_j,'sjis'); &jcode'convert(*cat_descrip,'sjis'); print "

$cat_name_j

\n"; print "
$cat_descrip
\n"; print "


\n"; if (@afile) { foreach (reverse sort @afile) { ($mark,$date,$time,$replydate,$replytime,$name,$email,$url_title,$url,$section,$subject,$descrip,$picture_url,$material,$markend,$last)=split(/\|\|\|/,$_); $descrip="説明:
$descrip"; $picture_url="画像:$img_dir_url/$picture_url"; &jcode'convert(*name,'sjis'); &jcode'convert(*picture_url,'sjis'); &jcode'convert(*subject,'sjis'); &jcode'convert(*material,'sjis'); &jcode'convert(*descrip,'sjis'); &jcode'convert(*url_title,'sjis'); print "\n"; print "
$name(E-Mail:$email  URL:$url)
\n"; print "$subject $url_title/$material\n"; print "($date/$time)
\n"; if ($picture_url){ if ($picture_url ne 'http://') { print "
$picture_url
\n"; } } print "
$descrip
\n"; print "
\n"; print "



\n"; } } last; } } &foot; } ############################ #ペット紹介コーナーを見る sub show_cat { &open_config; if ($bgcolor eq '') { $bgcolor="white"; } if ($t_width eq '') { $t_width="70%"; } $image =~ s/"/"/g; $d_title_color =~ s/"/"/g; $title_color =~ s/"/"/g; $stylesheet =~ s/
//g; $showsection = $FORM{'section'}; open(FILE,"<$basedir/$showsection$txtnum\.txt") || &error("ファイルがオープンできません。\n"); &lock; @afile = ; &unlock; close(FILE); print "\n"; print "\n"; print "\n"; print "\n"; print "$cat_name_j\n"; if ($use_stylesheet==1) { print "$stylesheet\n"; } print "\n"; if ($show_ads==1) { print "
$adsbanner_top


"; } print "

$cat_name_j

\n"; print "
$cat_descrip
\n"; print "



\n"; if (@afile) { foreach (reverse sort @afile) { ($mark,$date,$time,$replydate,$replytime,$name,$email,$url_title,$url,$sections,$subject,$descrip,$picture_url,$material,$markend,$last)=split(/\|\|\|/,$_); &body_html; } print "
\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "\n"; print "
キーワード
\n"; print "

\n"; print "

\n"; &last_html; } else { print "
現在このカテゴリーに登録されているペットはありません。


\n"; } print "

[BACK]

\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "shiromuku(u)PET $version
\n"; if ($show_ads==1) { print "
$adsbanner_bottom
"; } print "\n"; } ############################ #表示用のHTML sub body_html { $picture_url = "$img_dir_url/$picture_url"; if ($use_blank==1) { $target = "_blank"; } else { $target = "_top"; } if ($table_color) { print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; $descripm =~ s/
/\n/g; print "\n"; print "
\n"; } else { print "
\n"; } print "\n"; if ($icon_url){ if ($icon_url ne 'http://') { print "\n"; } } print "\n"; if ($email){ print "\n"; print "
$subject$url_title/$material)\n"; if ($date &&$time){ print "記入日時$date/$time\n"; } print "
投稿者$name\n"; } else { print "
投稿者$name\n"; } if ($url){ if ($url ne 'http://') { print "(HOME)\n"; } } print "
\n"; print "\n"; print "
\n"; if ($picture_url){ if ($picture_url ne "$img_dir_url/") { if ($width) { print "\n"; } else { print "\n"; } } } print "$descrip
\n"; unless (($FORM{'removearticle'}) || ($action eq "search_all") || ($action eq "search_all_list") || ($action eq "search_all_lists")) { print "
\n"; print "
PASS\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; } if ($FORM{'removearticle'}) { print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; &id_html; print "
\n"; print "

\n"; } print "


\n"; if ($line_url) { if ($line_url ne 'http://') { print "
\n"; print "

\n"; } } elsif (($line_url eq '') && ($table_color eq '')) { print "
\n"; } print "
\n"; } ############################ #全記事条件検索処理 sub search_all_lists { $showsection = $FORM{'section'}; $searchword = $FORM{'searchword'}; &head("検索結果"); print "


\n"; print "

次の記事が条件に一致しました。

\n"; while ($txtnum >= 1) { open(FILE,"<$basedir/$showsection$txtnum\.txt") || &error("ファイルがオープンできません。\n"); &lock; @afile = ; &unlock; close(FILE); foreach (reverse @afile) { ($mark,$date,$time,$replydate,$replytime,$name,$email,$url_title,$url,$section,$subject,$descrip,$picture_url,$material,$markend,$last)=split(/\|\|\|/,$_); $replydateandtimer= "$date|||$time"; if ($descrip =~ /$searchword/i || $date =~ /$searchword/i || $subject =~ /$searchword/i || $url_title =~ /$searchword/i || $name =~ /$searchword/i || $material =~ /$searchword/i ) { &body_html; print "


\n"; } } $txtnum = $txtnum-1; @afile = (); } print "

\n"; &foot; } ############################ #全記事検索処理 sub search_all_list { $searchword = $FORM{'searchword'}; if ($searchword eq '') { &error("キーワードを記入して下さい。\n"); } &head("検索結果"); print "


\n"; print "

次の記事が$searchwordに一致しました。

\n"; open(FILE,"<$basedir/$catfile") || die $!; &lock; @csfile = ; &unlock; close(FILE); foreach (@csfile) { ($mark,$section,$cat_name_jss,$cat_descripss,$newdatess,$markend,$last)=split(/\|\|\|/,$_); $txtnum = &get_number ("$section$txtnumfile", '1'); while ($txtnum >= 1) { open(FILE,"<$basedir/$section$txtnum\.txt") || &error("ファイルがオープンできません。\n"); &lock; @afile = ; &unlock; close(FILE); foreach (reverse @afile) { ($mark,$date,$time,$replydate,$replytime,$name,$email,$url_title,$url,$sections,$subject,$descrip,$picture_url,$material,$markend,$last)=split(/\|\|\|/,$_); $replydateandtimer= "$date|||$time"; if ($descrip =~ /$searchword/i || $date =~ /$searchword/i || $subject =~ /$searchword/i || $url_title =~ /$searchword/i || $name =~ /$searchword/i || $material =~ /$searchword/i ) { print "
(カテゴリー)$cat_name_jss

\n"; &body_html; print "


\n"; } } $txtnum = $txtnum-1; @afile = (); } } print "

\n"; &foot; } ############################ #head部分のHTML sub head_html { if ($bgcolor eq '') { $bgcolor="white"; } $stylesheet =~ s/
//g; print "\n"; print "\n"; print "\n"; print "\n"; print "$d_title_color\n"; if ($use_stylesheet==1) { print "$stylesheet\n"; } print "\n"; if ($show_ads==1) { print "
$adsbanner_top


"; } print "
\n"; print "$title
\n"; if ($introduction) { print "
\n"; print "$introduction
\n"; } } ############################ #過去の記事を見る部分のHTML sub last_html { $lastnum = $txtnum; $txtnum = &get_number ("$showsection$txtnumfile", '1'); print "
このページ$lastnum

\n"; print "
\n"; print "\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; $txtnum = $lastnum; } ############################ #書き込み用のHTML sub add_html { if (($action eq "user_a") || ($action eq "user")) { $c_name = $namem; $c_email = $emailm; $c_url = $urlm; $c_url_title = $url_titlem; } if ($picture_urlm eq '') { $picture_urlm = "http://"; } print "
投稿者名
E-Mail
URL
イヌの名前
イヌの種類
イヌの性別\n"; print "
アップロードする画像
$f_maxバイト以下にして下さい。(1000バイトは約1KBです。)\n"; print "
アップロード出来るファイルの拡張子は\n"; foreach (@allowed_ext) { print "$_ \n"; } print "です。\n"; print "
\n"; if (($action eq "user_a") || ($action eq "user")) { print "
画像を変更したい場合のみ記入して下さい。\n"; print "
画像を削除\n"; } print "
イヌの紹介
\n"; } ############################ #検索HTML sub search_html { print "
\n"; print "\n"; print "\n"; print "
カテゴリーキーワード

\n"; } ############################ #日時の取得 sub get_date { $ENV{'TZ'} = "JST-9"; ($secn,$minn,$hourn,$dayn,$monn,$yearn,$weekn,$yeardayn,$isdst) = localtime(time); $monn=$monn+1; $yearn=$yearn+1900; if ($monn<10) {$monn="0$monn";} if ($dayn<10) {$dayn="0$dayn";} if ($hourn<10) {$hourn="0$hourn";} if ($minn<10) {$minn="0$minn";} if ($secn<10) {$secn="0$secn";} $week = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat")[$weekn]; $date ="$yearn/$monn/$dayn/$week"; $time ="$hourn\:$minn\:$secn"; } ############################ #修正・削除画面 sub user_a { if ($action eq "user_a") { &check_pass; } if ($action eq "user") { $test_pass = &crypt ($replydate, 'aa'); } $removedate = "$date|||$time"; &head("記事の修正・削除"); open(FILE,"<$basedir/$section$lastnum\.txt") || &error("ファイルがオープンできません。\n"); &lock; @afile = ; &unlock; close(FILE); foreach (@afile) { ($mark,$datem,$timem,$replydatem,$replytimem,$namem,$emailm,$url_titlem,$urlm,$sectionm,$subjectm,$descripm,$picture_urlm,$materialm,$markend,$last)=split(/\|\|\|/,$_); if ($removedate eq "$datem|||$timem") { if ((($action eq "user") && ($replydatem eq $test_pass) && ($FORM{replydate} ne '')) || ($action eq "user_a")) { print "
\n"; print "\n"; if ($action eq "user") { print "\n"; print "\n"; } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; &add_html; if ($action eq "user_a") { &id_html; print "
\n"; } print "
\n"; print "
\n"; print "


\n"; print "
\n"; if ($action eq "user") { print "\n"; print "\n"; } if ($action eq "user_a") { print "
\n"; &id_html; print "
\n"; print "\n"; } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "

\n"; last; } } } &foot; } ############################ #設定ファイル読み込み sub open_config { open(FILE,"<$basedir/$setteifile"); &lock; $sfile = ; &unlock; close(FILE); ($mark,$back,$title,$image,$bkgd_img,$line_url,$icon_url,$bgcolor,$title_color,$text_color,$link_color,$introduction,$d_title_color,$i_color,$table_color,$stylesheet,$t_width,$markend,$last)=split(/\|\|\|/,$sfile); } ############################ #アップロードしたファイルの表示 sub show_files { print "

\n"; print "あなたがアップロードされたデザイン設定用画像ファイルのURLは以下の通りです。デザイン設定、デザイン設定用画像の削除などの際にご利用下さい。

\n"; opendir (DIR, "$c_basedir_h"); foreach $filename ( readdir (DIR) ) { next if $filename eq '.'; next if $filename eq '..'; next if $filename eq '.htaccess'; next if $filename eq 'index.html'; next if $filename =~ /html$/; print "$c_img_dir_url/${filename} 見る
\n"; } closedir (DIR); print "
\n"; }