Files
ore/public.cgi

225 lines
6.6 KiB
Perl
Executable File

#!/usr/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; charset=UTF-8\n\n";
print <<"EOM";
<html>
<head>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
<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>" ;
}