|
|
sub DspSource {
# ******************************************************************************
# ソースの表示
# ******************************************************************************
print( "<a name=stop></a>\n" );
local($open) = "http://tohoho.wakusei.ne.jp/wwwperl2.htm#open";
local($here_document) = "http://tohoho.wakusei.ne.jp/wwwperl1.htm#EOF";
local($file_test) = "http://flex.ee.uec.ac.jp/texi/perl/perl_22.html#SEC41";
local($file_read) = "http://tohoho.wakusei.ne.jp/wwwperl1.htm#InputFile";
local($unshift) = "http://tohoho.wakusei.ne.jp/wwwperl2.htm#unshift";
local($unless) = "http://tohoho.wakusei.ne.jp/wwwperl1.htm#unless";
local($split) = "http://flex.ee.uec.ac.jp/texi/perl/perl_56.html#SEC91";
local($shift) = "http://flex.ee.uec.ac.jp/texi/perl/perl_53.html#SEC88";
local($style) = "font-weight:bold;font-size:18";
local($headstyle) = "line-height:2;border-style:outset;background-color:skyblue";
local($headbutton) = " <input type=button value='戻る' onClick='history.back();'>";
print "<hr size=1 color=black>\n";
print "<pre>\n";
open( IN, "light.cgi" );
while (<IN>) {
$_ =~ s/\"/"&/g;
$_ =~ s/</<&/g;
$_ =~ s/>/>&/g;
$_ =~ s/</<&/g;
$_ =~ s/>/>&/g;
$_ =~ s/"/"&/g;
$_ =~ s/open\(/<a href='$open' style='$style'>open<\/a>\(/g;
$_ =~ s/print <</<a href='$here_document' style='$style'>print <<<\/a>/g;
$_ =~ s/-e/<a href='$file_test' style='$style'>-e<\/a>/g;
$_ =~ s/@[A-Za-z0-9_]*\s*=\s*<[A-Za-z0-9_]*>/<a href='$file_read' style='$style'>$&<\/a>/g;
$_ =~ s/unshift\s*\(/<a href='$unshift' style='$style'>unshift<\/a>\(/g;
$_ =~ s/(unless)\s*\(/<a href='$unless' style='$style'>$1<\/a>\(/g;
$_ =~ s/(split)\s*\(/<a href='$split' style='$style'>$1<\/a>\(/g;
$_ =~ s/(shift)\s*\(/<a href='$shift' style='$style'>$1<\/a>\(/g;
$_ =~ s/sub\s*([A-Za-z0-9_]*)\s*\{/<a name=$1><\/a><h4 style='$headstyle'> sub $1 {$headbutton<\/h4>/g;
$_ =~ s/ / &/g;
$_ =~ s/&([A-Za-z0-9_]+);/<a href='#$1' style='$style'>&$1;<\/a>/g;
$_ =~ s/"&/"/g;
$_ =~ s/<&/</g;
$_ =~ s/>&/>/g;
$_ =~ s/ &/ /g;
print $_;
}
close( IN );
print "</pre>\n";
}
1;
| |
|
|
|
|
## LIGHT BOARDのメイン処理
&decode;
#if ($mode eq "howto") { &howto; }
#elsif ($mode eq "find") { &find; }
#elsif ($mode eq "usr_del") { &usr_del; }
#elsif ($mode eq "msg") { ®ist; }
#&html_log;
&get_agent;
open(LOG,"$logfile") || &error("Can't open $logfile");
@lines = <LOG>;
close(LOG);
$init = $lines[0];
($head,$title,$t_color,$t_size,$t_face,$bgr,$bgc,$text,$link,
$vlink,$alink,$home,$max,$subj_color,$name_color,$mail1,$mail2)
= split(/<>/,$init);
shift(@lines);
&header;
print <<HTML;
<center><font color=$t_color size=$t_size face=$t_face>
<b>$title</b></font><hr width='90%' size=2>
[<a href=$home target=_top>トップにもどる</a>]
[<a href=$script?mode=howto>掲示板の使い方</a>]
[<a href=$script?mode=find>ワード検索</a>]
<hr width=90% size=2></center>
<form method="$method" action="$script">
<input type=hidden name=mode value="msg">
<blockquote><table border=0>
<tr><td nowrap><b>おなまえ</b></td>
<td><input type=text name=name size="$nam_wid" value="$c_name"></td></tr>
<tr><td nowrap><b>Eメール</b></td>
<td><input type=text name=email size="$nam_wid" value="$c_email"></td></tr>
<tr><td nowrap><b>題 名</b></td>
<td><input type=text name=sub size="$subj_wid" value=\"$res_sub\">
<input type=submit value="投稿する"><input type=reset value="リセット"></td></tr>
<tr><td colspan=2><b>コメント</b><br>
<TEXTAREA cols="$com_wid" rows=7 name=comment wrap="$wrap">$res_comment</TEXTAREA></td></tr>
<tr><td nowrap><b>URL</b></td>
<td><input type=text size="$url_wid" name=url value="http://$c_url"></td></tr>
<tr><td nowrap><b>削除キー</b></td>
<td><input type=password name=pwd size=8 maxlength=8 value="$c_pwd">
<small>(記事削除時に使用。英数字で8文字以内)</small></td></tr>
</table></form></blockquote><hr>
HTML
while (($key,$val) = each %FORM ) {
print "$key = $val<br>\n";
}
| |
|
|
|
|
#============#
# 設定完了 #
#============#
## LIGHT BOARDのメイン処理
&decode;
&get_agent;
open(LOG,"$logfile") || &error("Can't open $logfile");
@lines = <LOG>;
close(LOG);
$init = $lines[0];
($head,$title,$t_color,$t_size,$t_face,$bgr,$bgc,$text,$link,
$vlink,$alink,$home,$max,$subj_color,$name_color,$mail1,$mail2)
= split(/<>/,$init);
shift(@lines);
&header;
require './gamen.pl';
#=================================================
print '入力データの表示<br>' . "\n";
while (($key,$val) = each %FORM ) {
print "$key = $val<br>\n";
}
print "<hr>\n";
#=================================================
print '$lines[0]の表示<br>' . "\n";
print "$init\n";
print "<hr>\n";
#=================================================
print '中身の表示<br>' . "\n";
@work = split(/<>/,$init);
foreach $target ( @work ) {
print "$target<br>\n";
}
print "<hr>\n";
#=================================================
unshift(@lines,"$FORM{'name'}<>$FORM{'email'}<>$FORM{'sub'}<>$FORM{'comment'}<>$FORM{'url'}<>$FORM{'pwd'}<>\n");
unshift(@lines,$init);
#=================================================
open(LOG,">$logfile") || &error("Can't write $logfile");
print LOG @lines;
close(LOG);
#=================================================
print "入力データを書き込みました<br>\n";
| |
|
|
|
|
#=================================================
$comment = $FORM{'comment'};
$comment =~ s/\r\n/<br>/g;
$comment =~ s/\r/<br>/g;
$comment =~ s/\n/<br>/g;
unshift(@lines,"$FORM{'name'}<>$FORM{'email'}<>$FORM{'sub'}<>$comment<>$FORM{'url'}<>$FORM{'pwd'}<>\n");
unshift(@lines,$init);
| |
|
|
|
|
#=================================================
print "入力データを書き込みました<br>\n";
open(LOG,"$logfile") || &error("Can't open $logfile");
@lines = <LOG>;
close(LOG);
shift(@lines);
foreach $target (@lines) {
($name,$email,$subj,$comment,$url,$pwd)
= split(/<>/,$target);
print "<table border=0 cellpadding=0 cellspacing=0><tr>\n";
print "<td valign=top><font color=$subj_color><b>$subj</b></font> ";
print "投稿者:<font color=$name_color><b>$name</b></font> ";
print "<small>投稿日:$date</small></td><td> </td>\n";
print "<td valign='top'><form action=$script method=$method>\n";
print "<input type=submit value=返信>\n";
print "<input type=hidden name=mode value=res>\n";
print "<input type=hidden name=resmode value=$number>\n";
print "</td></form></tr></table>\n";
print "<blockquote>$comment<P>$url</blockquote><hr>\n";
}
| |
|
|
|
|
if ($mode eq "msg") {
#=================================================
open(LOG,">$logfile") || &error("Can't write $logfile");
print LOG @lines;
close(LOG);
#=================================================
print "入力データを書き込みました<br>\n";
}
| |
|
|
|
|
shift(@lines);
foreach $target (@lines) {
($name,$email,$subj,$comment,$url,$pwd)
= split(/<>/,$target);
&print_log;
}
sub print_log {
print "<table border=0 cellpadding=0 cellspacing=0><tr>\n";
print "<td valign=top><font color=$subj_color><b>$subj</b></font> ";
print "投稿者:<font color=$name_color><b>$name</b></font> ";
print "<small>投稿日:$date</small></td><td> </td>\n";
print "<td valign='top'><form action=$script method=$method>\n";
print "<input type=submit value=返信>\n";
print "<input type=hidden name=mode value=res>\n";
print "<input type=hidden name=resmode value=$number>\n";
print "</td></form></tr></table>\n";
print "<blockquote>$comment<P>$url</blockquote><hr>\n";
}
| |
|
|
|