![]() |
「KENTとはじめるCGI - 厳選Perlスクリプト集 」のご案内 |
| サイズ種別 | B5変 1色 |
| ページ数 | 288 |
| ISBN | 4-7973-1841-4 |
| 付録情報 | CD-ROM(1) |
| 本体価格 | \2,400 |
| 出版日 | 2002/04/20 |
| 入手案内のページ |
まずは、スクリプトのカストマイズからはじめよう!
掲示板、カウンタ、チャットの定番ものから、全文検索、検索エンジン、
自動リンク集、日記カレンダ、WEBクイズなど、
「使えるCGI」を収録した付録CD-ROM付。本書オリジナルも多数!
はじめに 第1章 CGIをはじめるまえに 第2章 CGIの仕組み 第3章 掲示板を開設しよう 3-1. 掲示板の設置 3-2. 掲示板の仕組み 3-3. 掲示板のカスタマイズ 3-4. 付録掲示板の紹介 会員制フォーラム iモード掲示板 メルマガ新着情報ボード 第4章 アクセスカウンタを設置しよう 4-1. アクセスカウンタの設置 4-2. アクセスカウンタのカスタマイズ カウントダウン 時刻表示 カレンダ表示 アクセス解析機能 第5章 チャットを開設しよう 5-1. チャットの設置 5-2. チャットのカスタマイズ アクセス拒否の仕方 ROM禁止機能 管理者呼出機能 第6章 全文検索システムを導入しよう 6-1. 全文検索システムの設置 6-2. 全文検索システムのカスタマイズ 文字コード変換機能 第7章 検索エンジンを設置しよう 7-1. 検索エンジンの設置 7-2. 検索エンジンのカスタマイズ 他サイトからの検索窓の作り方 他サイトからのアクセス拒否 時間帯での検索休止 第8章 自動リンク集を設置しよう 8-1. 自動リンク集の設置 第9章 データベースを設置しよう 9-1. 簡易データベースの設置 第10章 WEBクイズで遊ぼう 10-1. WEBクイズの設置 トラブルシューティング |
■変更前(662行目付近)
# 親記事のとき
if ($in{'oya'} == $in{'no'}) {
$flag=1;
$pw2=$pw;
if ($in{'no'} == $no || $in{'no'} == $reno) { next; }
■変更後
# 親記事のとき
if ($in{'oya'} == $in{'no'}) {
$flag=1;
if ($in{'no'} == $no) { $pw2=$pw; next; }
elsif ($in{'no'} == $reno) { next; }
(2) iモードからの絵文字入力がパソコン側に反映されないことのある不具合。
■変更前 (127行目付近) # 絵文字番号 @image = (63647 .. 63812); ■変更後 # 絵文字番号 @image = (63647 .. 63740, 63808 .. 63817, 63824 .. 63827, 63829 .. 63831, 63835 .. 63838, 63858 .. 63870, 63872 .. 63920);
■変更前(741行目付近)
# コード判別(半角カナ対策)
if (!$imode) {
$code = $in{'code'};
$code = &jcode'getcode(*code);
if ($code ne "sjis") {
&jcode'convert(*i_nam, 'sjis', "$code");
&jcode'convert(*i_sub, 'sjis', "$code");
&jcode'convert(*i_com, 'sjis', "$code");
}
}
■変更後
# 絵文字対策
if ($imode) {
$sj = '[\x80-\x9F\xE0-\xF7\xFA-\xFC][\x40-\x7E\x80-\xFC]|[\x00-\x7F]|[\xA1-\xDF]';
$em = '[\xF8\xF9][\x40-\x7E\x80-\xFC]';
$i_sub =~ s/\G((?:$sj)*)($em)/$1.''.unpack('n',$2).';'/ego;
$i_com =~ s/\G((?:$sj)*)($em)/$1.''.unpack('n',$2).';'/ego;
# コード判別(半角カナ対策)
} else {
$code = $in{'code'};
$code = &jcode'getcode(*code);
if ($code ne "sjis") {
&jcode'convert(*i_nam, 'sjis', "$code");
&jcode'convert(*i_sub, 'sjis', "$code");
&jcode'convert(*i_com, 'sjis', "$code");
}
}
(3) 不要な設定項目の削除 (記事内容訂正及びスクリプトの修正)
■記事内容の訂正 (P108) $comlen に関する設定部分 → 削除 ■変更前(64行目付近) # 記事当りの表示文字数(全角換算) # → これを超える記事は以降をカットし、<続き> のリンクを作成 $comlen = 60; ■変更後 # 記事当りの表示文字数(全角換算) # → これを超える記事は以降をカットし、<続き> のリンクを作成 #$comlen = 60; ■変更前(175行目付近) $comlen *= 2; ■変更後 #$comlen *= 2;
▼P207「CGI実行ディレクトリが特に決まっていない場合」ディレクトリ構成例のファイル名誤植
rank.dat → rank.log
▼P207「CGI実行ディレクトリが専用ディレクトリの場合」ディレクトリ構成例のファイル名誤植
rank.dat → rank.log
linkディレクトリ内 rank.html [666] 追加
▼P209「設定」の誤植
$script = './cruiser.cgi'; → $script = './link.cgi';
▼表示部のメニューリンク部で、リンク先の不具合 (link.cgi 278行目付近)
・変更前
foreach (0 .. $#parts) {
if ($_ == $half) { print OUT ""; }
# ページを定義
if ($_ <= 1) {
$filepath2 = $htm_dir . "index.html";
$fileurl2 = $htm_url . "index.html";
} else {
$tmp = int($_ / 2) + 1;
$filepath2 = $htm_dir . "index$tmp\.html";
$fileurl2 = $htm_url . "index$tmp\.html";
}
if ($filepath eq $filepath2) { $top = $top1color; }
else { $top = $top2color; }
print OUT "<td><font color=\"$top\">■</font>";
print OUT "<a href=\"$filepath2\">$parts[$_]</a></td>\n";
}
・変更後
foreach (0 .. $#parts) {
if ($_ == $half) { print OUT " "; }
# ページを定義
if ($_ <= 1) {
$filepath2 = $htm_dir . "index.html";
$fileurl2 = $htm_url . "index.html";
} else {
$tmp = int($_ / 2) + 1;
$filepath2 = $htm_dir . "index$tmp\.html";
$fileurl2 = $htm_url . "index$tmp\.html";
}
if ($filepath eq $filepath2) { $top = $top1color; }
else { $top = $top2color; }
print OUT "<td><font color=\"$top\">■</font>";
print OUT "<a href=\"$fileurl2\">$parts[$_]</a></td>\n";
}
▼ランキング表示の更新処理の不具合 (link.cgi 856行目付近)
・変更前
open(R,"$ranklog") || &error("Open Error : $rankfile");
while ($no = <R>) {
chop($no);
$NO{($no)[0]}++;
}
close(R);
・変更後
open(R,"$ranklog") || &error("Open Error : $rankfile");
$top = <R>;
while ($no = <R>) {
$no =~ s/\D//g;
next if ($no eq "");
$NO{($no)[0]}++;
}
close(R);
- 会員制フォーラム :スクリプトの修正
▼ forum.cgi 1904行目付近(パスワードファイルの設定とセキュリティ改善)
・現状
#-------------#
# ID/PW認証 #
#-------------#
sub pass_check {
local($time,$time2,$inpw,$flag,$id,$pw,$check);
# 時間を取得
$time = time;
$timeout = 30*60;
$password = 'milkcafe';
$pwdfile = 'pwd.cgi';
・変更後
#-------------#
# ID/PW認証 #
#-------------#
sub pass_check {
local($time,$time2,$inpw,$flag,$id,$pw,$check);
# 時間を取得
$time = time;
$timeout = 30*60;
$password = 'Th23IK98'; # ← 適当な英数字8文字で変更
$pwdfile = 'pwd.cgi'; # ← パスワードのファイル名を変更する場合はここを修正
▼ admin.cgi 41行目付近(ロックファイル名の変更)
・現状
$lockfile = './lock/wforum.lock';
・変更後
$lockfile = './lock/forum.lock'; # ← forum.cgiのロックファイル名に合わせる
- 検索エンジン :スクリプトの修正
▼ cruiser.cgi 995行目付近(カテゴリ内表示の不具合 → 特に NetScape6 では表示が乱れる)
・現状
foreach ("AND", "OR") {
if ($in{'cond'} eq $_) {
print "<option value=\"$_\" selected>$_\n";
} else {
print "<option value=\"$_\">$_\n";
}
}
print "<input type=submit value=' 検索 '>\n";
print "<small>[このカテゴリの中から検索]</small></form><hr>\n";
・変更後
foreach ("AND", "OR") {
if ($in{'cond'} eq $_) {
print "<option value=\"$_\" selected>$_\n";
} else {
print "<option value=\"$_\">$_\n";
}
}
print "</select> <input type=submit value=' 検索 '>\n";
print "<small>[このカテゴリの中から検索]</small></form><hr>\n";
- 全文検索 :スクリプト修正(セキュリティ対策)
▼ wfinder.cgi, wfinder2.cgi 289行目付近
・現状
foreach (@buf) {
($key, $val) = split(/=/);
$val =~ tr/+/ /;
$val =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
&jcode'convert(*val, 'sjis');
$in{$key} = $val;
}
・変更後
foreach (@buf) {
($key, $val) = split(/=/);
$val =~ tr/+/ /;
$val =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$val =~ s/&/&/g;
$val =~ s/</</g;
$val =~ s/>/>/g;
$val =~ s/"/"/g;
&jcode'convert(*val, 'sjis');
$in{$key} = $val;
}
消費者金融の審査基準
消費者金融徹底比較
消費者金融の強引な取立て対策
フランチャイズ
マイナスイオン扇風機 新林の滝