#! /usr/bin/perl # # profile.cgi # # 1.264 : 10/7/10 : 最大登録数の処理を修正 # 1.263 : 4/9/08 : GDをImage::Size変更 # 1.262 : 6/18/07 : 画像表示パスのバグを修正 # 1.261 : 11/21/06 : 修正ページパスワード入力を修正 # 1.260 : 6/28/06 : 画像ファイルが無い場合の処理を修正 # 1.259 : 4/6/06 : 登録最大数登録している場合に削除できないバグを修正 # 1.258 : 1/23/06 : 画像以外のファイルのアップロード処理を追加 # 1.257 : 1/8/06 : 画像ファイル名処理を修正 # 1.256 : 1/7/06 : 画像処理を修正。jcode.plを削除 # 1.255 : 10/21/05 : メール送信のMIMEを修正 # 1.254 : 10/1/05 : Copyrightにリンクを追加 # 1.253 : 7/2/05 : 修正時に最終項目に改行が入ってしまうのを修正 # 1.252 : 7/1/05 : メンバー専用パスワードを新規登録のみに変更 # 1.251 : 6/30/05 : メンバー専用パスワードを追加 # 1.250 : 3/31/05 : sendmailのオプションを修正 # 1.249 : 3/28/05 : 記事更新時にメールを送るオプションを追加 # 1.248 : 3/19/05 : お名前の項目名設定を追加。表示順に登録順、更新順のオプション追加 # 1.247 : 3/6/05 : 登録者一覧に別ページで表示のオプション追加 # 1.246 : 3/5/05 : 登録者一覧のオプション、最新順、古い順表示オプション追加 # 1.245 : 2/21/05 : 管理用セットアップのパスワード認証でまれにミスするバグを修正 # 1.244 : 2/9/05 : 管理人オンリーモードで「新規登録」をクリックするとパスワードを # を要求するように修正 # 1.243 : 2/8/05 : CGI::Carpをコメントアウト # 1.242 : 2/7/05 : 管理人オンリーモードを追加。「新規登録」非表示モード追加。 # 1.241 : 2/7/05 : Location:の後にスペースを追加。AnHTTPD対応。 # 1.240 : 2/6/05 : CGI::Carpを追加 # 1.239 : 5/17/04 : 修正時にパスワードと共にエンターを押した場合のエラー処理を追加 # 1.238 : 3/20/04 : 表示画面のパスワード項目名を変更可能に修正 # 1.237 : 2/20/04 : 画像表示位置指定オプションを設定ページに追加 # 1.236 : 2/14/04 : 項目欄の文字の位置を設定できるように修正 # 一人がアップできる合計ファイルサイズ制限設定を追加 # 1.235 : 2/6/04 : 登録、修正フォームの1行目を変更できるように修正 # スタイルシート用ににid=buttonを追加。 # 1.234 : 2/5/04 : 前ページ、次ページの位置指定できるように修正 # 1.233 : 7/1/03 : 小さい画像も$max_wの横幅に合わせるように修正 # 1.232 : 6/30/03 : 管理者が個人のパスワードを変更できるように修正 # 1.231 : 5/25/03 : 自動リンクにマッチする文字列を改良 # 1.230 : 5/10/03 : アップ画像サイズ設定が設定毎に20kBずつ増えてしまうバグを修正 # 表示部のパスワード入力テキストサイズを縮めた。 # 1.229 : 4/21/03 : 写真のコメントを変更できるように修正 # 1.228 : 4/19/03 : 最大アップサイズに書き込みテキスト用のサイズマージン(20kB)を追加 # 1.227 : 4/15/03 : テーブルレイアウトの設定を追加 # 最大ファイルサイズのオプション追加 # 1.226 : 4/6/03 : ヘッダーに好きな構文を挿入できるオプション追加 # 1.225 : 3/24/03 : パスワード作成失敗処理を追加 # 1.224 : 3/12/03 : 文中のリンクが長くなるのを防止するためhttp://からの # 自動リンクを文字列に書き換えるよう修正 # 1.223 : 3/8/03 : 1ページの表示制限オプションを追加 # 表次ページにバージョン表示追加 # 1.222 : 3/6/03 : $cgibinの設定を削除 # 1.221 : 3/4/03 : http://からのオートリンクを追加 # 1.22 : 2/27/03 : 管理人コメントを追加 # 管理人パスワードで他人の書き込みを修正した場合 # その人のパスワードが変更されてしまうバグを修正 # テキストエリアのサイズのオプションを追加 # 予備のアップデートファイルオプションを追加 # 1.211 : 2/25/03 : Copyright表記 # 管理人用注意書きを追加 # 1.21 : 2/24/03 : エラッタを修正。書き込みアイテム数を一旦増やして # 最後のほうに書き込んだ後、アイテム数を減らすと # 現在のアイテム数以上の項目に既に書き込まれたアイテムを # 変更できない問題を修正。 # テーブルのバックグラウンドカラー設定を追加。 # 各記事の更新時間設定を追加 # 1.2 : 2/23/03 : 管理人セットアップ機能を追加 # 1.11 : 2/17/03 : 画像の拡張子大文字にも対応、トップページへのリンクを追加 # 1.1 : 2/15/03 : 削除機能追加、写真が無い時にブランクのカラムを非表示 # 1.0 : 1/24/03 : Initial Revision # # http://www.hidekik.com/ # # Copyright(c) 2003-2010, Hideki Kanayama All rights reserved # use POSIX; use CGI::Carp qw(fatalsToBrowser); use Image::Size; use Jcode; require "cgi-lib.pl"; #管理人パスワードファイル $admindat = "adminpwd.dat"; #セットアップファイル $setupfile = "profile_setup.pl"; $version = "1.264"; $lastmodifiedyear = "2010"; $lang = 0; #### 環境設定 ###### ここから ############ $prdir = "../profile"; $prfile = "$prdir/profile.lst"; #$cgibin = "../cgi-bin"; $program = $0; $program =~ s/^.+[\/\\]([^\/\\]+)$/$1/; $script = "$program"; $dellog = "$prdir/delete.lst"; # バックグラウンド設定 # Background設定 # 1:画像を使う 0:カラー番号を使う $bgimage_en = 1; $bgimagefile = "$prdir/sample.jpg"; $bgcolor="#ffffff"; #テーブルのバックグラウンド 1: on, 0: off $table_bgcolor_en = 0; $table_bgcolor = '#ffffff'; #名前欄の色 $namebgcolor='lightblue'; #タイトル $title_logo_en = 0; $title = 'プロファイル'; $title_color='blue'; $regtitle_logo_en = 0; $regtitle = 'プロファイル登録'; $regtitle_color='blue'; $edititle_logo_en = 0; $edititle = 'プロファイル修正'; $edititle_color='blue'; $register_title_logo_en = 0; $register_title = '新規登録'; $setup_title_logo_en = 0; $setup_title = '管理用'; #トップへのリンク 1: on 0:off $toplink_en = 1; $toplink_logo_en = 0; $toplink_title = 'トップへ'; $toplink_link = "../profile.html"; #登録者リスト表示 0:非表示 1:上に表示 2:下に表示 3:別ウィンドウに表示 4:別ページに表示 $list_display = 0; $list_logo_en = 0; $list_logo = ''; $list_title = '登録者リスト'; #登録者リストの一行に表示される人数 $list_cols = 5; #表示順 0:最新順 1:古い順 $disp_order = 0; #記事更新時の表示順 0:登録順 1:更新順 $reorder = 1; #削除機能 1: on, 0: off $delete_en = 1; #管理人セットアップ表示 1: on, 0: off $setup_en = 1; #登録リンク表示 1:on 0:off $regform_en = 1; #管理人オンリーモード 1:on, 0:off $admin_only_en = 0; #最終更新表示 1: on, 0: off $lastupdate_en = 1; $lastupdate = 'Last Update : '; $lastupdate_color = '#3333ff'; $lastupdate_form = '1'; #各記事更新表示 1: on, 0: off $eachupdate_en = 1; $eachupdate = '更新時間'; $eachupdate_form = '1'; #登録修正フォームの1行目 $item = '項目'; $item_color = 'black'; $item_bgcolor = 'lightblue'; $contents = '内容'; $contents_color = 'black'; $contents_bgcolor = 'lightblue'; #項目欄の文字位置 $item_lr = 0; # 0:左 1:中 2:右 $item_ud = 1; # 0:上 1:中 2:下 #お名前の項目名 $name_in = 'お名前'; #パスワード項目名 $passitem = 'パスワード'; #修正ボタン名 $editbutton = '修正する'; #削除ボタン名 $deletebutton = '削除する'; #アイテムの最大数 $itemmaxnum = 9; #1度にアップできる画像の最大数 $picmaxnum = 6; #1ページ表示制限 1:on 0:off $pagedisp_en = 0; #1ページ表示件数 $pagedispnum = 10; # 次ページ前ページリンク名 $prev_icon_en = 0; $next_icon_en = 0; $prev_icon = ''; $next_icon = ''; $prevpage = '←前ページ'; $nextpage = '次ページ→'; $prev_loc = 0; $next_loc = 2; $first_icon_en = 0; $first_icon = ''; $firstpage = '最初に戻る'; #入力項目のデフォルト、最大$itemmaxnum項目(デフォルト9) @item_value = ('家族構成','生年月日','最近の出来事'); # 画像ファイルの最大表示の大きさ(単位:ピクセル) # → これを超える画像は縮小表示します $max_w = 150; # 横幅 $max_h = 150; # 縦幅 #最大画像アップサイズ(kB) $maxmb = 300; #一人がアップできる合計ファイルサイズ制限 1:on 0:off $size_check_en = 1; #一人がアップできる合計ファイルサイズ(kB) $allocated_size = 300; #最大登録件数 $postmax = 100; #画像クリック時 1: 同じウィンドウ 0: 別ウィンドウ $samewin_en = 1; #画像表示位置 0:左 1:中 2:右 $pic_loc = 1; #表示テーブルのサイズ(パーセント) $table_width = 60; #項目欄のサイズ(パーセント) $item_width = 20; #テーブルのレイアウト $table_layout_en = 0; $bordercolor = '#000000'; $table_border = 1; $cellpadding = 1; $cellspacing = 1; #書き込みテキストエリアのサイズ $textarea_cols = 50; $textarea_rows = 3; #各記事ごとの
ライン 1:on 0:off $hr_en = 1; #本文中のリンクを文字列に置き換える 1:on 0:off $link_replace_en = 1; $link_replace = 'リンクはこちら'; $link_replace_top_en = 0; #メール送信 1:on 0:off $reg_mail_en = 0; $up_mail_en = 0; $del_mail_en = 0; $reg_mail_title = 'profile.cgi -- 登録情報'; $up_mail_title = 'profile.cgi -- 更新情報'; $del_mail_title = 'profile.cgi -- 削除情報'; $mail_contents = 'profile.cgiが更新されました。'; $to_mail = 'admin@yourdomain.com'; $from_mail = 'admin@yourdomain.com'; $mail_cmd = '/usr/sbin/sendmail -t'; #メンバー専用パスワード 1:on 0:off $member_only = 0; $member_pwd = '12345'; #〜内に挿入できる構文 1:on, 0:off $head_insert_en = 0; $head_insert = ''; #スタイルシート 1:on 0:off $style_sheet_en = 1; $style_sheet = ' A:link {text-decoration: none} A:visited {text-decoration: none} A:active {text-decoration: none} '; #書き込みの注意事項 $usage = ' '; #時間設定 $offset = 9; #トップからのSSI表示による更新時間のための予備のアップデートファイル # 1: on, 0: off $update1_file_en = 0; $update2_file_en = 0; $update1_file = "$prdir/update1.log"; $update2_file = "$prdir/update2.log"; #### 環境設定 ###### ここまで ############ if (-e "$setupfile"){ require "$setupfile"; } if ($bgimage_en == 1){ $bgset = "background=\"$bgimagefile\""; } else { $bgset = "bgcolor=\"$bgcolor\""; } if ($table_bgcolor_en == 1){ $table_bgcolor2 = "bgcolor = $table_bgcolor"; } else { $table_bgcolor2 = ''; } if ($maxmb < 100) {$maxmb = 100;} $maxmb2 = $maxmb + 20; # Margin for text up size $cgi_lib::maxdata = $maxmb2 * 1024; $maxsize = $cgi_lib::maxdata; if ($maxsize > 1048576){ $maxsize = sprintf("%.1fMB",$maxsize/1048576); } elsif ($maxsize > 1024){ $maxsize = sprintf("%.1fkB",$maxsize/1024); } else { $maxsize = sprintf("%dB",$maxsize); } &ReadParse; while (($key,$value)=each %in){ if ($key !~ /upfile\d+_pic/){ $value = jcode($value)->sjis; $value =~ s//>/g; $br = "
"; if ($value =~ /\r\n/) { $value =~ s/\r\n/$br/g; } if ($value =~ /\n/) { $value =~ s/\n/$br/g; } if ($value =~ /\r/) { $value =~ s/\r/$br/g; } if ($value =~ /,/) { $value =~ s/,/,/g; } $in{"$key"}=$value; } } if (! -e "$admindat"){ if ($in{mode} ne 'adminpwd'){ &setadminpwd; } else { &wradminpwd; print "Location: $script?mode=read\n\n"; } } open(ADMIN,"< $admindat"); $adminpwd = ; close(ADMIN); if ($in{mode} eq 'register'){ ®ister; } elsif ($in{mode} eq 'edit'){ &edit; } elsif ($in{mode} eq 'regform'){ if ($admin_only_en == 1 && $in{pwd} eq ''){ $in{next} = 'regform'; &setup; } else { ®form; } } elsif ($in{mode} eq 'editform'){ &editform; } elsif ($in{mode} eq 'setup'){ &setup; } elsif ($in{mode} eq 'setform'){ &setform; } elsif ($in{mode} eq 'setupwrite'){ &setupwrite; } elsif ($in{mode} eq 'list_display'){ &list_display; } elsif ($in{mode} eq 'read'){ &display; } else { if ($list_display == 3){ &frameset; } else { &display; } } sub frameset { print "Content-type: text/html\n\n"; print < $title END } sub register { ################ 登録 ####################### if (open(FILE,"< $prfile")){ while (){ ($count,@dum)=split(/,/); push(@countlist,$count); } close(FILE); @countlist2 = sort {$a <=> $b} @countlist; $count = $countlist2[$#countlist2] + 1; } else { $count = 1; } if ($count > $postmax){ &error("これ以上登録できません。"); } if ($in{'yourname'} eq "") { &error("名前を入れてください。"); } if ($in{'pwd'} eq "") { &error("パスワードを入れてください。"); } if ($admin_only_en == 1 && (! &checkcrypt($in{pwd},"$adminpwd"))){ &error("管理人オンリーモードなので管理人のみ書き込みができます。"); } if ($member_only == 1 && ("$in{member_pwd}" ne "$member_pwd")){ &error('メンバー専用パスワードが違います。'); } foreach $picnum (1 .. $picmaxnum){ $uppic = "upfile${picnum}_pic"; foreach (@in){ if ($_ =~ /name=\"$uppic\"/){ if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; } if ($_ =~ /(.*)filename=\"(.*)\"/i) { $origfile=$2; $origfile =~ s/^.*[\\\/]([^\\\/]+)$/$1/; $fname[$picnum]="$count-$picnum-$origfile"; } } } if ($origfile eq ""){next;} $fname[$picnum] =~ tr/\"\x0D\x0A//d; $outfile = "$prdir/$fname[$picnum]"; $origfile =~ s/^.+[\/\\]([^\/\\]+)$/$1/; #just in case if ("$origfile" !~ /^[\w\.\-]+$/) { &error("$origfile:アップ後のファイル名は半角英数で。"); } open(OUT,"> $outfile") || &error("アップロードに失敗しました。"); binmode(OUT); print OUT $in{$uppic}; close(OUT); chmod (0666,$outfile); $fileterm = $fileterm . "$uppic" . '=' . "$fname[$picnum]" . '<>'; $upcom = "upfile${picnum}_com"; $filecomterm = $filecomterm . "$upcom" . '=' . "$in{$upcom}" . '<>'; } ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime(time + 3600 * $offset); $update = sprintf("%s_%s_%s_%02s_%02s",$year+1900,$mon+1,$mday,$hour,$min); $encpwd = &makecrypt($in{pwd}); open(DAT,">> $prfile"); print DAT "$count,$update,$in{yourname},$encpwd,$fileterm,$filecomterm"; foreach $a (1 .. $itemmaxnum){ $tmpa = "item${a}_key"; $tmpb = "item${a}_elem"; print DAT ",$in{$tmpa}<>$in{$tmpb}"; } print DAT "\n"; close(DAT); chmod(0666,"$prfile"); if ($update1_file_en == 1){ open(UPDATE,">$update1_file"); print UPDATE "dummy file1\n"; close(UPDATE); chmod(0666,"$update1_file"); } if ($update2_file_en == 1){ open(UPDATE,">$update2_file"); print UPDATE "dummy file2\n"; close(UPDATE); chmod(0666,"$update2_file"); } if ($reg_mail_en == 1){ &mailnotice("$reg_mail_title","$in{yourname}"); } print "Location: $script?mode=read\n\n"; } sub edit { ################ 編集 ####################### #print "Content-Type: text/html\n\n"; open(ADMIN,"< $admindat"); $adminpwd = ; close(ADMIN); if ($in{'pwd'} eq "") { &error("削除用パスワードを正しく入れてください。"); } @newlist=(); open(DLFILE,"< $prfile"); while(){ s/[\r\n]*$//; ($count,$update,$name,$encpwd,$fileterm,$filecomterm,@item_keyelem)=split(/,/); $editcount = "edit$count"; if ("$in{edit_num}" == $count){ # if ((&checkcrypt($in{pwd},"$encpwd") && ($encpwd ne '')) # || &checkcrypt($in{pwd},"$adminpwd")){ @fileterm_list = split(/<>/,$fileterm); @filecomterm_list = split(/<>/,$filecomterm); $fileterm_tmp = ''; $filecomterm_tmp = ''; $filesize_sum=0; foreach $a (1 .. $in{old_picnum_end}){ $tmppic = "upfile${a}_pic"; $tmpcom = "upfile${a}_com"; if ($in{$tmppic} ne 'on'){ @aaa = grep(/$tmppic=/,@fileterm_list); # @bbb = grep(/$tmpcom=/,@filecomterm_list); if ($aaa[0] eq '') {next;} $fileterm_tmp = $fileterm_tmp . $aaa[0] . "<>"; # $filecomterm_tmp = $filecomterm_tmp . $bbb[0] . "<>"; $filecomterm_tmp = $filecomterm_tmp . "$tmpcom=$in{$tmpcom}" . "<>"; if ($size_check_en == 1){ $pic_filename = $aaa[0]; $pic_filename =~ s/$tmppic=//; ($d_dev,$d_ino,$d_mode,$d_nlink,$d_uid,$d_gid,$d_rdev,$d_size,$d_atime,$d_mtime,$d_ctime,$d_blksize,$d_blocks)=stat("$prdir/$pic_filename"); $filesize_sum=$filesize_sum + $d_size; } } else { @aaa = grep(/$tmppic=/,@fileterm_list); $aaa[0] =~ /$tmppic=(.+)/; $deletefile = $1; unlink("$prdir/$deletefile"); } } $allocated_size2 = $allocated_size * 1024 + 20480; # margin 20KB if ($size_check_en == 1){ $filesize_sum = $filesize_sum + $ENV{'CONTENT_LENGTH'}; if ($filesize_sum > $allocated_size2){ &error("一人がアップロードできる合計ファイルサイズが${allocated_size}kBを越えています。"); } } $fileterm = $fileterm_tmp; $filecomterm = $filecomterm_tmp; foreach $picnum ($in{new_picnum_start} .. $in{new_picnum_end}){ $uppic = "upfile${picnum}_pic"; $new_picnum = $old_picnum + $picnum; foreach (@in){ if ($_ =~ /name=\"$uppic\"/){ if ($_ =~ /(.*)Content-type:(.*)/i) { $tail=$2; } if ($_ =~ /(.*)filename=\"(.*)\"/i) { $origfile=$2; $origfile =~ s/^.*[\\\/]([^\\\/]+)$/$1/; $fname[$picnum]="$count-$picnum-$origfile"; } } } if ($origfile eq ""){next;} $fname[$picnum] =~ tr/\"\x0D\x0A//d; $outfile = "$prdir/$fname[$picnum]"; $origfile =~ s/^.+[\/\\]([^\/\\]+)$/$1/; #just in case if ("$origfile" !~ /^[\w\.\-]+$/) { &error("$origfile:アップ後のファイル名は半角英数で。"); } open(OUT,"> $outfile") || &error("アップロードに失敗しました。"); binmode(OUT); print OUT $in{$uppic}; close(OUT); chmod (0666,$outfile); $fileterm = $fileterm . "$uppic" . '=' . "$fname[$picnum]" . '<>'; $upcom = "upfile${picnum}_com"; $filecomterm = $filecomterm . "$upcom" . '=' . "$in{$upcom}" . '<>'; } ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime(time + 3600 * $offset); $update = sprintf("%s_%s_%s_%02s_%02s",$year+1900,$mon+1,$mday,$hour,$min); if (! &checkcrypt($in{adminpwd},"$adminpwd")){ $encpwd = &makecrypt($in{pwd}); } else { if ($in{pwdreset} eq 'on'){ $encpwd = &makecrypt($in{pwd2}); } else { $encpwd = $in{pwd}; } } $aaa = "$count,$update,$in{yourname},$encpwd,$fileterm,$filecomterm"; foreach $a (1 .. $itemmaxnum){ $tmpa = "item${a}_key"; $tmpb = "item${a}_elem"; $aaa = $aaa . ",$in{$tmpa}<>$in{$tmpb}"; } $aaa = $aaa . "\n"; # } else { # &error("パスワードが違います。"); # } push (@newlist,"$aaa") if ($reorder == 0); } else { push(@newlist,"$_\n"); } } close(DLFILE); push(@newlist,$aaa) if ($reorder == 1); open(DAT,"> $prfile"); print DAT @newlist; close(DAT); if ($update1_file_en == 1){ open(UPDATE,">$update1_file"); print UPDATE "dummy file1\n"; close(UPDATE); chmod(0666,"$update1_file"); } if ($update2_file_en == 1){ open(UPDATE,">$update2_file"); print UPDATE "dummy file2\n"; close(UPDATE); chmod(0666,"$update2_file"); } if ($up_mail_en == 1){ &mailnotice("$up_mail_title","$in{yourname}"); } print "Location: $script?mode=read\n\n"; } sub regform { ################ 登録フォーム ####################### if ($admin_only_en == 1 && ! &checkcrypt($in{pwd},"$adminpwd")){ &error('パスワードが違います。'); } print "Content-Type: text/html\n\n"; &beginning; if ($regtitle_logo_en == 1){ print "

\"$regtitle\"

\n"; } else { print "

$regtitle

\n"; } ®explain; print <<"EOM";
EOM if ($table_layout_en == 1){ print "\n"; } else { print "
\n"; } print < EOM2 foreach (1 .. $itemmaxnum){ print < COMS } foreach (1 .. $picmaxnum){ print < PICS } if ($member_only == 1){ print < END3 } if ($admin_only_en == 1){ $pwdmessage = '管理人パスワード'; } else { $pwdmessage = '修正用パスワード'; } print <
$item $contents
$name_in
画像ファイル
画像コメント

メンバー専用パスワード
$pwdmessage
 
EOM2 &ending; } sub editform { ################ 修正フォーム ####################### #print "Content-Type: text/html\n\n"; ##### 削除 #### for($i=1;$i<=$postmax;$i=$i+1){ $tmp = "delete${i}"; if ($in{$tmp} ne ''){ $edit_num = $i; $hitline = 1; open(WRITE,"> $prdir/tmp.$$"); open(DELLOG,">> $dellog"); if (open(FILE,"< $prfile")){ while(){ ($count,$update,$name,$encpwd,$fileterm,$filecomterm,@item_keyelem)=split(/,/,$_); if ($count == $edit_num){ if (!((&checkcrypt($in{pwd},"$encpwd") && ("$encpwd" ne '')) || &checkcrypt($in{pwd},"$adminpwd"))){ close(DELLOG); close(WRITE); unlink("$prdir/tmp.$$") &error("パスワードが違います。"); } print DELLOG $_; @tmp_list=split(/<>/,$fileterm); foreach (@tmp_list){ ($itemname,$filename)=split(/=/); $itemname =~ /upfile(\d+)_pic/; push(@picnumlist,$1); } @aaa = sort {$a <=> $b} @picnumlist; $old_picnum_end = $aaa[$#aaa]; foreach $a (1 .. $old_picnum_end){ $tmppic = "upfile${a}_pic"; $tmpcom = "upfile${a}_com"; @aaa = grep(/$tmppic=/,@tmp_list); $aaa[0] =~ /$tmppic=(.+)/; $deletefile = $1; unlink("$prdir/$deletefile"); } } else { print WRITE $_; } } close(FILE); } close(WRITE); close(DELLOG); rename("$prdir/tmp.$$","$prfile"); if ($del_mail_en == 1){ &mailnotice("$del_mail_title","$name"); } print "Location: $script?mode=read\n\n"; exit; } } ##### 修正フォーム #### for($i=1;$i<=$postmax;$i=$i+1){ $tmp = "edit${i}"; if ($in{$tmp} ne ''){ $edit_num = $i; $hitline = 1; last; } } if (open(FILE,"< $prfile")){ while(){ ($count,@dump)=split(/,/,$_); if ($count == $edit_num){ chomp; $thisline = $_; last; } } close(FILE); } open(ADMIN,"< $admindat"); $adminpwd = ; close(ADMIN); ($count,$update,$name,$encpwd,$fileterm,$filecomterm,@item_keyelem)=split(/,/,$thisline); if ($hitline == 0) { &error("
パスワードを入力して【Enter】キーではなく、をクリックしてください。"); } elsif (!((&checkcrypt($in{pwd},"$encpwd") && ("$encpwd" ne '')) || &checkcrypt($in{pwd},"$adminpwd"))){ &error("パスワードが違います。"); } print "Content-Type: text/html\n\n"; &beginning; if ($edititle_logo_en == 1){ print "

\"$edititle\"

\n"; } else { print "

$edititle

\n"; } ®explain; print <<"EOM"; EOM if ($table_layout_en == 1){ print "\n"; } else { print "
\n"; } print < EOM2 $item_keyelem_num = $#item_keyelem+1; if ($itemmaxnum >= $item_keyelem_num){ $item_max = $itemmaxnum; } else { $item_max = $item_keyelem_num; } $keycount = 1; foreach (1 .. $item_max){ ($key,$elem)=split(/<>/,$item_keyelem[$_-1]); $elem =~ s/
/\n/g; if ($key ne ''){ print ""; print ""; $elem =~ s/(http..*)<\/a>/$1/; print "\n"; print "\n"; $keycount = $keycount + 1; } } if ($keycount <= $itemmaxnum){ foreach ($keycount .. $itemmaxnum){ print ""; print ""; print "\n"; print "\n"; } } @tmp=split(/<>/,$fileterm); foreach (@tmp){ ($itemname,$filename)=split(/=/); $itemname =~ /upfile(\d+)_pic/; push(@picnumlist,$1); } @aaa = sort {$a <=> $b} @picnumlist; $old_picnum_start = $aaa[0]; $old_picnum_end = $aaa[$#aaa]; $new_picnum_start = $old_picnum_end + 1; $new_picnum_end = $old_picnum_end + $picmaxnum; foreach ($new_picnum_start .. $new_picnum_end){ print < PICS } if ($fileterm ne ''){ print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print ""; print "\n"; print ""; print "\n"; print <
$item $contents
$name_in
画像ファイル
画像コメント

\n"; print ""; @piclist = split(/<>/,$fileterm); @comlist = split(/<>/,$filecomterm); $i=1; foreach $pic (@piclist){ ($pic eq '') && next; ($picname,$picfile)=split(/=/,$pic); $picname =~ /upfile(\d+)_pic/; $picnum = $1; $comname = "upfile${picnum}_com"; @com1 = grep(/^$comname=/,@comlist); $com = $com1[0]; $com =~ /$comname=(.*)/; $comment = $1; $picfile =~ /(.+)(\..+)/; $pichead = $1; $tail = $2; $picfile = "$prdir/$picfile"; if (-e "$picfile") { ($pic_width,$pic_height)=&get_image_size($picfile,$max_w,$max_h); if ($pic_width < $max_w) { $pic_width2 = $max_w; } else { $pic_width2 = $pic_width; } } else { $pic_width2 = $max_w; } if ($i % 3 == 1) {print "";} print "\n"; if ($i % 3 == 0) {print "";} $hiddeninfo = $hiddeninfo . "<>" . "upfile${picnum}_pic"; $i = $i + 1; } print "
"; if (-e "$picfile") { print &image_tag($picfile,$pic_width,$pic_height); } else { print "<No Image>"; } print "
\n"; print "
"; print "↑削除
"; print "
"; } print "
修正用パスワード"; if (&checkcrypt($in{pwd},"$encpwd") && ("$encpwd" ne '')){ print "←パスワードを変更できます"; } else { print "\n"; print "\n"; print ""; print "←パスワードを変更するときチェック"; } print "
 
EOM2 &ending; } sub image_tag { my ($image,$w,$h) = @_; if ($w == 0 or $h == 0) { return "<File>"; } else { return ""; } } sub get_image_size { my ($image,$max_width,$max_height) = @_; my $imagefile = "$image"; my ($width, $height); if ($image =~ /\.gif$/i or $image =~ /\.jpe?g$/i or $image =~ /\.[xp][bp]m$/i or $image =~ /\.xv$/i or $image =~ /\.[pm]ng$/i or $image =~ /\.tif$/i or $image =~ /\.bmp$/i or $image =~ /\.psd$/i or $image =~ /\.swf$/i or $image =~ /\.cws$/i or $image =~ /\.pcd$/i) { ($width, $height) = imgsize($imagefile); } my $actual_width; my $actual_height; if ($width > $max_width or $height > $max_height){ my $width_shrink = $max_width / $width; my $height_shrink = $max_height / $height; my $shrink_ratio; if ($width_shrink < $height_shrink){ $shrink_ratio = $width_shrink; } else { $shrink_ratio = $height_shrink; } $actual_width = int($width * $shrink_ratio); $actual_height = int($height * $shrink_ratio); } else { $actual_width = $width; $actual_height = $height; } return($actual_width,$actual_height); } sub setup { ################ セットアップ用パスワード入力 ####################### local($next); if ($in{next} ne ''){ $next = $in{next}; } else { $next = 'setform'; } print "Content-type:text/html\n\n"; &beginning; print "
\n"; print "
管理者用パスワードを入力してください。
\n"; print "\n"; print "\n"; print "\n"; print "
"; print ""; exit; } sub setform { ################ セットアップフォーム ####################### open(ADMIN,"< $admindat"); $adminpwd = ; close(ADMIN); if (! &checkcrypt($in{pwd},"$adminpwd")){ &error('パスワードが違います。'); } print "Content-Type:text/html\n\n"; &beginning; #if (open(SETUP,"< $setupfile")){ # $perlpath = ; # $perlpath =~ s/^#\! *(.+) *[\r\n]*$/$1/; # close(SETUP); #} else { # $perlpath = "/usr/local/bin/perl"; #} $admin_only_check[$admin_only_en] = "checked"; $compatible_check[$compatible] = "checked"; $title_logo_check[$title_logo_en] = "checked"; $regtitle_logo_check[$regtitle_logo_en] = "checked"; $edititle_logo_check[$edititle_logo_en] = "checked"; $register_title_logo_check[$register_title_logo_en] = "checked"; $setup_title_logo_check[$setup_title_logo_en] = "checked"; $toplink_check[$toplink_en] = "checked"; $toplink_logo_check[$toplink_logo_en] = "checked"; $list_logo_check[$list_logo_en] = "checked"; $list_display_check[$list_display] = "checked"; $bgimage_check[$bgimage_en] = "checked"; $setup_check[$setup_en] = "checked"; $delete_check[$delete_en] = "checked"; $regform_check[$regform_en] = "checked"; $samewin_check[$samewin_en] = "checked"; $lastupdate_check[$lastupdate_en] = "checked"; $lastupdate_form_check[$lastupdate_form] = "checked"; $eachupdate_check[$eachupdate_en] = "checked"; $eachupdate_form_check[$eachupdate_form] = "checked"; $style_sheet_check[$style_sheet_en] = "checked"; $table_bgcolor_check[$table_bgcolor_en] = "checked"; $update1_file_check[$update1_file_en] = "checked"; $update2_file_check[$update2_file_en] = "checked"; $pagedisp_check[$pagedisp_en] = "checked"; $prev_icon_check[$prev_icon_en] = "checked"; $prev_loc_check[$prev_loc] = "checked"; $next_icon_check[$next_icon_en] = "checked"; $next_loc_check[$next_loc] = "checked"; $first_icon_check[$first_icon_en] = "checked"; $link_replace_check[$link_replace_en] = "checked"; $link_replace_top_check[$link_replace_top_en] = "checked"; $head_insert_check[$head_insert_en] = "checked"; $hr_check[$hr_en] = "checked"; $table_layout_check[$table_layout_en] = "checked"; $item_lr_check[$item_lr] = "checked"; $item_ud_check[$item_ud] = "checked"; $size_check_check[$size_check_en] = "checked"; $pic_loc_check[$pic_loc] = "checked"; $disp_order_check[$disp_order] = "checked"; $reorder_check[$reorder] = "checked"; $reg_mail_check[$reg_mail_en] = "checked"; $up_mail_check[$up_mail_en] = "checked"; $del_mail_check[$del_mail_en] = "checked"; $member_only_check[$member_only] = "checked"; $item_value = join(',',@item_value); if ($list_display == 3){ $target = "target=_parent"; } else { $target = "target=_self"; } print "
\n"; print "\n"; print "\n"; if ($table_layout_en == 1){ print "\n"; } else { print "
\n"; } print <
  • ディレクトリ、ファイルの設定は、$scriptから見た相対パス、又は絶対パスで指定してください。CGIと同じディレクトリの場合、.(半角ドット)でOKです。バックグランドファイルやロゴファイルはhttp://からのリンクの指定も可能\\です。
  • 管理人パスワードを変更するには、$admindatを削除して、$scriptを実行しなおしてパスワードを再入力してください。
  • 削除された記事は$dellogに保存されますので、ここから復帰したい行を$prfileにコピーすると記事が復元できます。但し、画像は復帰できません。
  • これらの設定は$setupfileに保存されます。また、$setupfileをエディタ等で変更してもこの設定ページに反映されます。
  • $scriptがバージョンアップされた場合、単純に$scriptだけを置き換えるだけで設定はそのまま使えます。
  • $admindatと$setupfileのファイル名はこの設定ページでは変更できません。変更したい場合は$scriptの中で変更してください。
  • 管理人パスワードで他人の書き込みを修正、削除することができます。
  • 管理用リンクを非表\\示にしている場合にこのページにアクセスするには、$script?mode=setupを実行するとアクセスできます。
  • 登録リンクを非表\\示にしている場合に登録ページにアクセスするには、$script?mode=regformを実行するとアクセスできます。
  • 画像アップサイズを変更した場合は、書き込みの注意事項内のサイズ部分も忘れずに変更してください。
  • 数字やカラー指定は必ず半角で指定してください。全角やブランクだとCGIが起動しなくなります。万一間違って全角で書いてしまった場合は、$setupfileをエディタで開きその場所を半角に正しく修正してください。それで直ります。
  • 送信ボタンなどのボタンはid=buttonがHTMLで設定されてるのでスタイルシートでボタンをデザインする時は、.button {...}で設定してください。
  • 各ページのタイトルは<H2>をつかってるのでスタイルシートでデザインを変更したい場合は、H2 {...}で設定してください。
データディレクトリ
データファイル
削除記事保存ファイル
バックグランド 画像を使う カラー設定にする
画像を使う場合の画像ファイル
カラー設定の場合のカラー番号(白:#ffffff 又は white)
表\\示テーブルのバックグラウンドカラー 有り 無し
色指定
名前欄のバックの色
管理人オンリーモード 有効 無効
有効にすると管理人のみ新規登録ができるようになります。
タイトル名 ロゴ使用 ロゴ非使用
ロゴ画像ファイル
タイトル名
その色
登録タイトル ロゴ使用 ロゴ非使用
ロゴ画像ファイル
タイトル名
その色
修正タイトル ロゴ使用 ロゴ非使用
ロゴ画像ファイル
タイトル名
その色
登録リンク表\\示 表\\示 非表\\示
登録リンク名 アイコン使用 アイコン非使用
アイコン画像ファイル
リンク名
管理用リンク表\\示 表\\示 非表\\示
管理用リンク名 アイコン使用 アイコン非使用
アイコン画像ファイル
リンク名
トップへのリンク表\\示 有り 無し
トップのリンク先
トップへのリンク名 アイコン使用 アイコン非使用
アイコン画像ファイル
リンク名
登録者一覧表\\示 非表\\示 上に表\\示 下に表\\示 別ページに表\\示 別ウィンドウで表\\示
登録者一覧の一行に表\\示される数
登録者一覧表\\示名 アイコン使用 アイコン非使用
アイコン画像ファイル
リンク名
最終更新時間表\\示とフォーム 有り 無し
最終更新タイトル
その色
yyyy年mm月dd日HH時MM分
yyyy/mm/dd HH:MM
HH:MM yyyy/mm/dd
HH:MM mm/dd/yyyy
各記事更新時間 表\\示 非表\\示
更新時間タイトル
yyyy年mm月dd日HH時MM分
yyyy/mm/dd HH:MM
HH:MM yyyy/mm/dd
HH:MM mm/dd/yyyy
登録修正フォームの1行目 項目欄名
項目欄の文字色
項目欄の背景色
内容欄名
内容欄の文字色
内容欄の背景色
項目欄の文字の位置

お名前の項目名
パスワード項目名
修正ボタン名
削除機能\\ 有効 無効
削除ボタン名
表\\示順 最新順 古い順
登録順 更新順
最新順は更新時間が最新の記事が最初に表\\示されます。古い順は更新時間が最古の記事が最初に表\\示されます。
登録順は記事を更新してもその記事は最新記事として認識されないので最新順や古い順にしても順序が変わりません。更新順は記事を更新するとそれが最新記事として扱われますので最新順でその記事が最初に表\\示されて、古い順でその記事が最後に表\\示されます。
登録順/更新順は記事の書き込み時に適用される(データファイルにそのように書き込まれる)ので記事が書き込まれた後この設定を変更しても表\\示順序は変わりません。
最新順/古い順は表\\示時に適用されるので設定を変えた時点で有効になります。
1ページ表\\示制限 有効 無効
 有効時に1ページに表\\示する件数
前ページのリンク名 アイコン使用 アイコン非使用
アイコン画像ファイル
前ページリンク名
位置
次ページのリンク名 アイコン使用 アイコン非使用
アイコン画像ファイル
次ページリンク名
位置
最初に戻るのリンク名 アイコン使用 アイコン非使用
アイコン画像ファイル
次ページリンク名
アイテムの最大数
画像の最大数  1度にアップできる画像の最大数
入力項目のデフォルト 半角カンマ(,)で区切ってください
画像表\\示サイズ 横幅 これを超える画像は縮小表\\示されます。
縦幅 但し画像をクリックするとフルサイズで表\\示されます。
画像アップサイズ KB 1度にアップできる最大合計サイズ
一人がアップできる合計画像サイズ制限 有効 無効
KB 現在アップされている画像も含め、一人がアップできる最大合計サイズ
最大登録件数
画像クリック時 同じウィンドウ 別ウィンドウ
画像表\\示位置
表\\示テーブルのサイズ パーセント ページ全体からのパーセント
項目欄のサイズ パーセント テーブル全体からのパーセント
テーブルレイアウト 有効 無効
bordercolor= border= cellpadding= cellspacing=
書き込みテキストエリアのサイズ 横幅
縦幅
<HR>ライン 有り 無し
自動リンクの置き換え 有効 無効
置き換える文字列
自動リンククリック時 同じウィンドウ 別ウィンドウ
メンバー専用パスワード 有効 無効
パスワード
メール送信 新規登録時 有効 無効 メールタイトル
記事更新時 有効 無効 メールタイトル
記事削除時 有効 無効 メールタイトル
メールコマンド
送り主(From:)
送り先(To:)
メール内容

<head>内挿入文 有効 無効
HTML書式
ポップアップ広告やJavascript、<META>を挿入したい場合にここに記述する。
以下の記述が<head>〜</head>内に挿入される。

スタイルシート 有効 無効

書き込みの注意事項 HTML書式

時間設定 GMTより時間(日本:+9時間)
予\\備のアップデートファイル 使用 非使用 ファイル名
使用 非使用 ファイル名
END print ""; print "
\n"; &ending; } sub setupwrite { ################ セットアップファイル作成 ####################### if (open(FILE,"< $admindat")){; $filepwd = ; close(FILE); if (! &checkcrypt($in{pwd},$filepwd)){ &error('パスワードが違います。'); } } else { print "Content-type:text/html\n\n"; print ""; print "パスワードファイルが存在しません。"; print ""; exit; } #print "Content-Type: text/html\n\n"; foreach (keys(%in)){ $in{$_} =~ s/
/\n/g; $in{$_} =~ s/,/,/g; $in{$_} =~ s/<//g; } $item_value1 = ''; foreach (split(/,/,"$in{item_value}")){ # print "$_
"; $item_value1 = $item_value1 . "\'$_\'" . ','; } #print @item_value1; #exit; open(SETUP,"> $setupfile"); print SETUP <ライン 1:on 0:off \$hr_en = $in{hr_en}; #書き込みテキストエリアのサイズ \$textarea_cols = $in{textarea_cols}; \$textarea_rows = $in{textarea_rows}; #本文中のリンクを文字列に置き換える 1:on 0:off \$link_replace_en = $in{link_replace_en}; \$link_replace = '$in{link_replace}'; \$link_replace_top_en = $in{link_replace_top_en}; #メール送信 1:on 0:off \$reg_mail_en = $in{reg_mail_en}; \$up_mail_en = $in{up_mail_en}; \$del_mail_en = $in{del_mail_en}; \$reg_mail_title = '$in{reg_mail_title}'; \$up_mail_title = '$in{up_mail_title}'; \$del_mail_title = '$in{del_mail_title}'; \$mail_contents = '$in{mail_contents}'; \$to_mail = '$in{to_mail}'; \$from_mail = '$in{from_mail}'; \$mail_cmd = '$in{mail_cmd}'; #メンバー専用パスワード 1:on 0:off \$member_only = $in{member_only}; \$member_pwd = '$in{member_pwd}'; #〜内に挿入できる構文 1:on, 0:off \$head_insert_en = $in{head_insert_en}; \$head_insert = '$in{head_insert}'; #スタイルシート 1:on 0:off \$style_sheet_en = $in{style_sheet_en}; \$style_sheet = '$in{style_sheet}'; #書き込みの注意事項 \$usage = '$in{usage}'; #時間設定 \$offset = $in{offset}; #トップからのSSI表\\示による更新時間のための予\\備のアップデートファイル # 1: on, 0: off \$update1_file_en = $in{update1_file_en}; \$update2_file_en = $in{update2_file_en}; \$update1_file = '$in{update1_file}'; \$update2_file = '$in{update2_file}'; #### 環境設定 ###### ここまで ############ END close(SETUP); if ($in{list_display} == 3){ print "Location: $script\n\n"; } else { print "Location: $script?mode=read\n\n"; } } sub display { ################ 表示 ####################### if (open(FILE,"< $prfile")){ @alldata=; close(FILE); } @alldata = reverse(@alldata) if ($disp_order == 0); ($d_dev,$d_ino,$d_mode,$d_nlink,$d_uid,$d_gid,$d_rdev,$d_size,$d_atime,$d_mtime,$d_ctime,$d_blksize,$d_blocks)=stat("$prfile"); @monarray=(Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime($d_mtime + $offset * 3600); if ($lastupdate_form == 1){ $date_str = POSIX::strftime("%Y年%m月%d日%H時%M分",$sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst); } elsif ($lastupdate_form == 2){ $date_str = POSIX::strftime("%Y/%m/%d %H:%M",$sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst); } elsif ($lastupdate_form == 3){ $date_str = POSIX::strftime("%H:%M %Y/%m/%d",$sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst); } elsif ($lastupdate_form == 4){ $date_str = POSIX::strftime("%H:%M %d/%m/%Y",$sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst); } else { $date_str = POSIX::strftime("%Y年%m月%d日%H時%M分",$sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst); } print "Content-Type: text/html\n\n"; &beginning; &header; print "
\n"; if ($toplink_en == 1){ if ($toplink_logo_en == 1){ if ($list_display == 3) { $target = "target=_parent"; } else { $target = "target=_self"; } print "\"$toplink_title\"\n"; } else { print "$toplink_title\n"; } } if ($admin_only_en == 1){ $regform_mode = "mode=setup&next=regform"; } else { $regform_mode = "mode=regform"; } if ($regform_en == 1){ if ($register_title_logo_en == 1){ print "\"$register_title\"\n"; } else { print "$register_title\n"; } } if ($list_display == 3 || $list_display == 4){ if ($list_display == 3){ $target = "target=_blank"; } else { $target = ''; } if ($list_logo_en == 1){ print "\"$list_title\"\n"; } else { print "$list_title\n"; } } if ($setup_en == 1){ if ($setup_title_logo_en == 1){ print "\"$setup_title\"\n"; } else { print "$setup_title\n"; } } print "
\n"; if ($hr_en == 1 && $list_display == 1){ print "
\n"; } &listgen if ($list_display == 1); $itemnumber = 0; $midoffile = 0; $actualdispnum = 0; $allmesnum = $#alldata + 1; $next = $in{next}; foreach (@alldata){ s/[\r\n]*$//; # instead of a chop ($count,$update,$name,$encpwd,$fileterm,$filecomterm,@item_keyelem)=split(/,/); next if ($in{number} ne '' && $in{number} != $count); $itemnumber = $itemnumber + 1; if ($pagedisp_en == 1){ if ($itemnumber < $next + 1){ next; } elsif ($itemnumber > $next + $pagedispnum){ $midoffile = 1; last; } } $actualdispnum = $actualdispnum + 1; if ($hr_en == 1){ print "
\n"; } else { print "
\n"; } if ($table_layout_en == 1){ print "\n"; } else { print "
\n"; } print ""; # print ""; print ""; print "\n"; @item_lr_name = ('left','center','right'); @item_ud_name = ('top','center','bottom'); foreach $keyelem (@item_keyelem){ ($key,$elem)=split(/<>/,$keyelem); if ($key eq '') {next;} print ""; print ""; if ($elem eq ''){$elem = " ";} if ($link_replace_top_en == 1){ $link_replace_target = 'target="_top"'; } else { $link_replace_target = 'target="_blank"'; } if ($link_replace_en == 1){ $elem =~ s/(https?:\/\/[\w\.\~\-\/\?\&\+\=\:\@\%\;\#\%\$]*)/$link_replace<\/a>$2/g; } else { $elem =~ s/(https?:\/\/[\w\.\~\-\/\?\&\+\=\:\@\%\;\#\%\$]*)/$1<\/a>$2/g; } print ""; print "\n"; } if ($fileterm ne ''){ @picalign = ('left','center','right'); print "
$itemnumber:$name$name
$key$elem
\n"; # print ""; @piclist = split(/<>/,$fileterm); @comlist = split(/<>/,$filecomterm); $piccnt = $#piclist + 1; $i=1; foreach $pic (@piclist){ ($pic eq '') && next; ($picname,$picfile)=split(/=/,$pic); $picname =~ /upfile(\d+)_pic/; $picnum = $1; $comname = "upfile${picnum}_com"; @com1 = grep(/^$comname=/,@comlist); $com = $com1[0]; $com =~ /$comname=(.*)/; $comment = $1; $picfile =~ /.+(\..+)/; $tail = $1; $picfile = "$prdir/$picfile"; if (-e "$picfile") { ($pic_width,$pic_height)=&get_image_size($picfile,$max_w,$max_h); if ($pic_width < $max_w) { $pic_width2 = $max_w; } else { $pic_width2 = $pic_width; } } else { $pic_width2 = $max_w; } if ($piccnt/3 >= 1){$colm_num = 3;} else {$colm_num = $piccnt;} if ($i % 3 == 1) {print "
\n\n";} print "\n"; if ($i % 3 == 0 and $colm_num % 3 != 0) {print "\n";} if ($i % 3 == $colm_num % 3) {print "\n
"; if ($samewin_en == 1){ $newwin = ''; } else { $newwin = 'target="_blank"'; } if (-e "$picfile") { print ""; print &image_tag($picfile,$pic_width,$pic_height); print ""; print "
\n"; print "$comment"; } else { print "<No Image>"; } print "
\n";} if ($i % 3 == $colm_num % 3) {$piccnt = $piccnt - $colm_num;} $i = $i + 1; } # print "
\n"; print "\n"; } if ($eachupdate_en == 1){ @yourdate = split(/_/,$update); if ($eachupdate_form == 1){ $dateform = sprintf("%s年%s月%s日%s時%s分",$yourdate[0],$yourdate[1],$yourdate[2],$yourdate[3],$yourdate[4]) } elsif ($eachupdate_form == 2){ $dateform = sprintf("%s/%s/%s %s:%s",$yourdate[0],$yourdate[1],$yourdate[2],$yourdate[3],$yourdate[4]) } elsif ($eachupdate_form == 3){ $dateform = sprintf("%s:%s %s/%s/%s",$yourdate[3],$yourdate[4],$yourdate[0],$yourdate[1],$yourdate[2]) } elsif ($eachupdate_form == 4){ $dateform = sprintf("%s:%s %s/%s/%s",$yourdate[3],$yourdate[4],$yourdate[1],$yourdate[2],$yourdate[0]) } else{ $dateform = sprintf("%s年%s月%s日%s時%s分",$yourdate[0],$yourdate[1],$yourdate[2],$yourdate[3],$yourdate[4]) } print "$eachupdate"; print "$dateform"; print "\n"; } print "
\n"; print "$passitem\n"; print "\n"; print "\n \n"; if ($delete_en == 1){ print "\n"; } print "\n"; print "
\n"; print "\n"; print "\n"; } if ($hr_en == 1){ print "
\n"; } else { print "
\n"; } $prevlink = ''; $nextlink = ''; if ($pagedisp_en == 1){ if ($itemnumber > $pagedispnum + $midoffile){ $prev = $itemnumber - $pagedispnum - $actualdispnum; $prev = $prev - $midoffile; if ($prev_icon_en == 1){ $prevlink = "
\"$prevpage\"\n"; } else { $prevlink = "$prevpage\n"; } } if ($midoffile == 1){ $next = $itemnumber-1; if ($next_icon_en == 1){ $nextlink = "\"$nextpage\"\n"; } else { $nextlink = "$nextpage\n"; } } } if ($first_icon_en == 1){ $firstlink = "\"$firstpage\"\n"; } else { $firstlink = "$firstpage\n"; } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; if ($prev_loc == 0){print "$prevlink";} if ($next_loc == 0){print "$nextlink";} print "\n"; if ($prev_loc == 1){print "$prevlink";} print "$firstlink\n"; if ($next_loc == 1){print "$nextlink";} print "\n"; if ($prev_loc == 2){print "$prevlink";} if ($next_loc == 2){print "$nextlink";} print "
\n"; if ($hr_en == 1 && $list_display == 2){ print "
\n"; } &listgen if ($list_display == 2); &ending; } sub listgen { my $target; if ($list_display == 3){ $target = "target=profile_main"; } else { $target = "target=_self"; } print "\n"; my $i = 0; my $flag = 0; foreach (@alldata){ s/[\r\n]*$//; # instead of a chop ($count,$update,$name,$encpwd,$fileterm,$filecomterm,@item_keyelem)=split(/,/); if ($i%$list_cols == 0 && $list_cols != 0) { print "\n"; $flag = 1; } print "\n"; if ($i%$list_cols == $list_cols-1 && $list_cols != 0) { print "\n"; $flag = 0; } $i++; } print "\n" if ($flag == 1); print "
$name
\n"; } sub list_display { print "Content-type: text/html\n\n"; $title = "$list_title"; &beginning; if (open(FILE,"< $prfile")){ @alldata=; close(FILE); } @alldata = reverse(@alldata) if ($disp_order == 0); &listgen; #&ending; print ""; } sub beginning { print "\n"; print < $title HEADPRINT if ($head_insert_en == 1){ print "$head_insert\n"; } if ($style_sheet_en == 1){ print "\n"; } print "\n"; print "\n"; } sub ending { #($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime(time + 3600 * $offset); #$year = $year + 1900; my $year = $lastmodifiedyear; if ($year > 2003){ $year = "2003-$year"; } my $mysite = ('http://www.hidekik.com/','http://www.hidekik.com/en/')[$lang]; print "
profile.cgi Ver. $version
Copyright(C) $year, hidekik.com
\n"; print "\n"; print "\n"; } sub header { if ($title_logo_en == 1){ print "

\"$title\"

\n"; } else { print "

$title

\n"; } if ($lastupdate_en == 1){ print "
$lastupdate $date_str

\n"; } } sub error { print "Content-Type: text/html\n\n"; &beginning; print "
$_[0]
\n"; print ""; print ""; exit; } sub makecrypt { my $plain = shift; my $salt = join "", ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64]; my $result = crypt($plain,$salt) or crypt($plain,'$1$'.$salt.'$'); return $result; } sub setadminpwd { print "Content-type:text/html\n\n"; print ""; print "
"; print "
管理者用パスワードを設定してください。
"; print ""; print ""; print ""; print "
"; print ""; exit; } sub wradminpwd { $passwd = &makecrypt($in{pwd}); if (open(FILE,"> $admindat")){ print FILE "$passwd"; close(FILE); } else { print "Content-type:text/html\n\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "パスワードファイル作成に失敗しました\n"; print "\n"; print "\n"; print "パスワードファイル作成に失敗しました。"; print "\n"; exit; } } sub checkcrypt { local($pwd,$encpwd)=@_; return(crypt($pwd,$encpwd) eq "$encpwd"); } sub regexplain { print < $usage NOTICE } sub mailnotice { local($subj,$name) = @_; $subj = jcode($subj)->jis; local $header; $header = "To: " . jcode($to_mail)->mime_encode . "\n"; $header .= "From: " . jcode($from_mail)->mime_encode . "\n"; $header .= "Subject: " . jcode($subj)->mime_encode . "\n"; $header .= "MIME-Version: 1.0\n"; $header .= "Content-type: text/plain; charset=ISO-2022-JP\n"; $header .= "Content-Transfer-Encoding: 7bit\n\n"; local $body; $body = $mail_contents; $body .= "\n"; $body .= "名前 :$name\n"; $body .= "Host : $ENV{REMOTE_HOST}\n"; $body .= "IP : $ENV{REMOTE_ADDR}\n"; $body .= "時間 : $update\n\n"; $body = jcode($body)->jis; if (open(SMAIL, "| $mail_cmd")){ print SMAIL $header; print SMAIL $body; close(SMAIL); } else { &error("メールコマンドが実行できません。"); } }