Files
ore/public.cgi
T
2026-06-22 21:09:26 +09:00

225 lines
6.4 KiB
Perl
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/local/bin/perl
# サーバーの環境に合わせて変更して下さい。
#-----------------------------------------------------------#
# 罪と罰++ 二律背反 #
# Copyright(C) 2001-2002 by Vivid Studio. BLANK BOARD #
# Vivid Studio.[ http://www17.big.or.jp/~obochan/vivid/ ] #
# BLANK BOARD [ http://pom.to/ ] #
#-----------------------------------------------------------#
$ver = '公式条約 v1.0'; # バージョン情報(変更不可)
#--- [注意事項] --------------------------------------------#
# 1.このスクリプトは以下の利用規程に従って配布しています。 #
# http://www24.big.or.jp/~obo/game/ore_/gild/ #
#-----------------------------------------------------------#
#===============================================================================
# 設定項目
#-------------------------------------------------------------------------------
# 各種ファイル
require './inc/ore_sub-bbs.cgi'; # 各種掲示板共通な設定項目読み込み
$script = "./public.cgi"; # このスクリプトのパス
$logfile = "./logdata/public_log.cgi";# ログファイルのパス
$lockkey = 0; # ファイルロック(0=no 1=yes)
$lockfile = "./public.lock"; # ロックファイル名
#-------------------------------------------------------------------------------
# 環境設定
$title = "公式条約"; # タイトル名
$max = 200; # 最大保有記事数
$write_limit= 300; # この秒数の間は再度投稿ができない
$com_limit = 4096; # コメントの最大文字数(半角換算)
$tagkey = 0; # タグの許可 (0=no 1=yes)
$nolink = 1; # URL宣伝排除 (0=no 1=yes)
$br_mode = 1; # 改行モード (0=no 1=yes)
# 機種別設定
if($mv_mode eq 'mv'){
# モバイル用設定
$log_last= 10; # 表示行数(モバイル)
# BODYタグ装飾
$body = 'body bgcolor="black" text="white" link="pink" vlink="pink" alink="pink"';
$hr_color= 'white'; # 罫線の色(モバイル)
}else{
# PC用設定
$log_last= 500; # 表示行数(PC)
# BODYタグ装飾
$body = 'bgcolor="#111122" text="#ddddee" link="#ffddee" vlink="#ffddee" alink="#ffddee"';
}
#===============================================================================
# 以下処理 基本的にこれ以下はいじらないように。
#-------------------------------------------------------------------------------
# メイン処理
&axs_check; # アクセス制御
&decode; # フォームデコード
&mandata_open; # 参加者ログ読み込み
&get_time; # 日時取得
if ($mode eq "regist" && $com) { &regist; } # 書き込み処理
&html; # ページ表示
#-------------------------------------------------------------------------------
# 記事表示部
sub html {
# 表示開始
&header;
if($mv_mode eq 'mv'){
print <<"EOM";
<b>$title</b>
<form name="park" method="$method" action="$script">
<input type=hidden name=mode value="regist">
<input type=hidden name=id value="$id">
<input type=hidden name=pw value="$pw">
<textarea name=comment rows="2" size=16></textarea><br>
<input type=submit value="発言"><input type=reset value="クリア">
</form>
<form name="ore_" method="$method" action="$ore_game">
<input type=hidden name=id value="$id">
<input type=hidden name=pw value="$pw">
<input type=hidden name=cmd value="-1">
<input type=submit value="戻る">
</form>
EOM
}
else{
print <<"EOM";
<table>
<tr>
<td width="220"><img src="./imgs/title_game.png" width="220" height="52"></td>
<td valign="bottom" align="left">
<b>$title</b><br>
<small> 条約や同盟、さらに稟議など </small>
</td>
</tr>
<form name="park" method="$method" action="$script">
<tr>
<td colspan="2" nowrap>
<input type=hidden name=mode value="regist">
<input type=hidden name=id value="$id">
<input type=hidden name=pw value="$pw">
<textarea name=comment class="button1" rows="4" style="width:400px;"></textarea>
</td>
</tr>
<tr>
<td align="left" colspan="2">
<input type=submit value="発言/更新" class="button1" style="width:80px">
<input type=reset value="クリア" class="button1" style="width:60px">
</td>
</tr>
</form>
<form name="ore_" method="$method" action="$ore_game">
<tr>
<td align="right" colspan="2">
<input type=hidden name=id value="$id">
<input type=hidden name=pw value="$pw">
<input type=hidden name=cmd value="-1">
<input type=submit value="戻る" class="button1" style="width:80px">
</td>
</tr>
</form>
</table>
EOM
}
($mv_mode eq 'mv') ?
print qq|<hr color=\"$hr_color\">\n|:
print qq|<hr size="8" color="#666699">\n|;
# ログを展開
open(IN,"$logfile") || &error("Open Error : $logfile");
local $log_last_flag=0;
while (<IN>) {
$log_last_flag++;
local($date,$nm,$camp,$com,$sogo,$addr,$host) = split(/<>/);
$nm = qq|$nm <small>[$sogo_p[$sogo]]</small>| if($sogo);
($mv_mode eq 'mv') ? $com =~ s/ハァト/<font color="pink">\&\#63726<\/font>/g : $com =~ s/ハァト/<span class="f1">ゥ<\/span>/g ;
($mv_mode eq 'mv') ?
print qq|$nm:$com [$camp_info[$camp][0] $date]<br>\n|:
print qq|<span style="color:$camp_info[$camp][1]">$nm <span class="date">[ $camp_info[$camp][0] $date ]</span><br>$com </span><hr>\n|;
last if $log_last_flag > $log_last;
}
close(IN);
# 著作権表示(削除禁止)
print "<hr>\n";
&copyright;
exit;
}
#-------------------------------------------------------------------------------
# ログ書き込み処理
sub regist {
# ファイルロック
if ($lockkey) { &lock; }
# ログを読み込み
open(IN,"$logfile") || &error("Open Error : $logfile");
@lines = <IN>;
close(IN);
my @y1 = split(/<>/,$lines[0]);
&error("暫く後に投稿してください。") if(($time<$y1[8]+$write_limit) && ($addr eq $y1[5]));
# 最大記事数処理
while ($max <= @lines) { pop(@lines); }
# ログ更新処理
unshift (@lines,"$date<>$DAT{'nm'}<>$DAT{'camp'}<>$com<>$DAT{'sogo'}<>$addr<>$host<>$agent<>$time<>\n");
open(OUT,">$logfile") || &error("Write Error : $logfile");
print OUT @lines;
close(OUT);
# ロック解除
if (-e $lockfile) { unlink($lockfile); }
}
#-------------------------------------------------------------------------------
# HTMLのヘッダー
sub header {
print "Content-type: text/html\n\n";
print <<"EOM";
<html>
<head>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=Shift_JIS">
<title>$title</title>
EOM
if($mv_mode eq 'pc'){
print <<"EOM";
$css
<script language="JavaScript">
<!--
function textfocus(){
document.park.comment.focus();
return true;
}
//-->
</script>
EOM
}
(!$_[0] && $mv_mode eq 'pc') ? print qq|</head>\n<body $body onLoad="return textfocus()">| : print "</head>\n<body $body>" ;
}