Initial commit of original files
This commit is contained in:
@@ -0,0 +1,308 @@
|
||||
#!/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.1'; # バージョン情報(変更不可)
|
||||
#--- [注意事項] --------------------------------------------#
|
||||
# 1.このスクリプトは以下の利用規程に従って配布しています。 #
|
||||
# http://www24.big.or.jp/~obo/game/ore_/gild/ #
|
||||
#-----------------------------------------------------------#
|
||||
|
||||
#===============================================================================
|
||||
# 設定項目
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# 各種ファイル
|
||||
|
||||
require './inc/ore_sub-bbs.cgi'; # 各種掲示板共通な設定項目読み込み
|
||||
|
||||
$script = "./park.cgi"; # このスクリプトのパス
|
||||
|
||||
$logfile = "./logdata/park_log.cgi"; # ログファイル
|
||||
|
||||
$memfile = "./logdata/park_mem.cgi"; # 参加者ファイル
|
||||
|
||||
$lockkey = 0; # ファイルロック(0=no 1=yes)
|
||||
|
||||
$lockfile = "./camp.lock"; # ロックファイル名
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# 環境設定
|
||||
|
||||
$title = "国際交流広場"; # タイトル名
|
||||
|
||||
$max = 100; # 最大保有記事数
|
||||
|
||||
$reload_mn = 5; # 最短リロード間隔(この秒数以内に発言するとエラー[負荷対策])
|
||||
|
||||
$reload_limit= 120; # この秒数発言がないと退室扱いにする
|
||||
|
||||
$com_limit = 240; # コメントの最大文字数(半角換算)
|
||||
|
||||
$tagkey = 0; # タグの許可 (0=no 1=yes)
|
||||
|
||||
$nolink = 1; # URL宣伝排除 (0=no 1=yes)
|
||||
|
||||
# 機種別設定
|
||||
if($mv_mode eq 'mv'){
|
||||
|
||||
# モバイル用設定
|
||||
|
||||
$log_last= 15; # 表示行数(モバイル)
|
||||
|
||||
# BODYタグ装飾
|
||||
$body = 'bgcolor="black" text="white" link="pink" vlink="pink" alink="pink"';
|
||||
|
||||
$hr_color= 'white'; # 罫線の色(モバイル)
|
||||
}else{
|
||||
|
||||
# PC用設定
|
||||
|
||||
@reload_time= (90,120,180); # リロード時間
|
||||
|
||||
$log_last= 50; # 表示行数(PC)
|
||||
|
||||
# BODYタグ装飾
|
||||
$body = 'bgcolor="#111122" text="#ddddee" link="#ffddee" vlink="#ffddee" alink="#ffddee"';
|
||||
}
|
||||
|
||||
#===============================================================================
|
||||
# 以下処理 基本的にこれ以下はいじらないように。
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# メイン処理
|
||||
&axs_check; # アクセス制御
|
||||
&decode; # フォームデコード
|
||||
&mandata_open; # 参加者ログ読み込み
|
||||
&get_time; # 日時取得
|
||||
&member;
|
||||
if($mode eq "regist" && $com){ ®ist; } # 書き込み処理
|
||||
&html; # ページ表示
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# 記事表示部
|
||||
sub html {
|
||||
# 表示開始
|
||||
&header;
|
||||
|
||||
if($mv_mode eq 'mv'){
|
||||
print <<"EOM";
|
||||
$camp_info[$DAT{'camp'}][0]専用<br>$title
|
||||
<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">
|
||||
<input type=text name=comment size=8>
|
||||
<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>
|
||||
<tr>
|
||||
<form name="park" method="$method" action="$script">
|
||||
<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">
|
||||
<input type="hidden" name="rd" value="$rd">
|
||||
<input type="text" name="comment" class="button1" style="width:300px">
|
||||
<input type="submit" value="発言/更新" class="button1" style="width:80px">
|
||||
<input type="reset" value="クリア" class="button1" style="width:60px">
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
<tr>
|
||||
<form 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">
|
||||
<td align="left">
|
||||
<tt>更新:<select name="rd" size="1" class="button1" style="width:60px">
|
||||
EOM
|
||||
|
||||
print qq|<option value="$rd">$reload_time[$rd]秒</option>|;
|
||||
foreach(0 .. $#reload_time){
|
||||
print qq|<option value="$_">$reload_time[$_]秒</option>| if($rd!=$_);
|
||||
}
|
||||
|
||||
print <<EOM;
|
||||
</select> <input type="submit" value="変更" class="button1" style="width:60px">
|
||||
</td>
|
||||
</form>
|
||||
<form name="ore_" method="$method" action="$ore_game">
|
||||
<td align="right">
|
||||
<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>
|
||||
</form>
|
||||
</tr>
|
||||
</table>
|
||||
EOM
|
||||
}
|
||||
|
||||
# 参加者表示:$member
|
||||
($mv_mode eq 'mv') ?
|
||||
print qq|参加者($num)<hr color=\"$hr_color\">\n|:
|
||||
print qq|<hr size="8" color="#666699"><span class=\"mem\"><br>参加者($num):$member</span><hr color="#c0c0c0" size="4">\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 : $com </span><span class="date">[ $camp_info[$camp][0] $date ]</span><hr>\n|;
|
||||
last if $log_last_flag > $log_last;
|
||||
}
|
||||
close(IN);
|
||||
|
||||
# 著作権表示(削除禁止)
|
||||
print "<hr>\n";
|
||||
©right;
|
||||
exit;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# ログ書き込み処理
|
||||
sub regist {
|
||||
|
||||
# ファイルロック
|
||||
if ($lockkey) { &lock; }
|
||||
|
||||
# ログを読み込み
|
||||
open(IN,"$logfile") || &error("Open Error : $logfile");
|
||||
@lines = <IN>;
|
||||
close(IN);
|
||||
|
||||
# 最大記事数処理
|
||||
while ($max <= @lines) { pop(@lines); }
|
||||
|
||||
# ログ更新処理
|
||||
unshift (@lines,"$date<>$DAT{'nm'}<>$DAT{'camp'}<>$com<>$DAT{'sogo'}<>$addr<>$host<>$agent<>\n");
|
||||
open(OUT,">$logfile") || &error("Write Error : $logfile");
|
||||
print OUT @lines;
|
||||
close(OUT);
|
||||
|
||||
# ロック解除
|
||||
if (-e $lockfile) { unlink($lockfile); }
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# 在室者処理
|
||||
sub member {
|
||||
open(IN,"$memfile") || &error("Open Error : $memfile");
|
||||
@data = <IN>;
|
||||
close(IN);
|
||||
|
||||
$member="";
|
||||
@new=();
|
||||
$flag=0;
|
||||
$flag2=0;
|
||||
foreach (@data) {
|
||||
($time2,$name2,$host2) = split(/<>/);
|
||||
|
||||
# 発言のない者は削除
|
||||
if ($time-$reload_limit > $time2) { next; }
|
||||
elsif ($host2 eq "$addr") {
|
||||
|
||||
# 発言/更新間隔
|
||||
# &error("$reload_mn秒以上間隔を空けて発言してください。") if($reload_mn+$time2>$time);
|
||||
if($reload_mn+$time2>$time){
|
||||
print "Status: 204\n\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# 退室者は削除
|
||||
if ($_[0] eq 'bye') { next; }
|
||||
|
||||
# ホスト名が同一であれば時間と名前を更新
|
||||
$_ = "$time<>$DAT{'nm'}<>$addr<>\n";
|
||||
$name2 = $DAT{'nm'};
|
||||
$flag=1;
|
||||
}
|
||||
# 更新用配列 @new に追加
|
||||
if ($name2 ne "$host2") {
|
||||
push(@new,$_);
|
||||
|
||||
# 参加者表示用文字列を作成
|
||||
if(!$flag2){$member .="$name2◇";$flag2=1;}
|
||||
else{$member .="$name2◆";$flag2=0;}
|
||||
}
|
||||
}
|
||||
# 新規参加者を追加
|
||||
if (!$flag && $mv_mode eq 'pc') {
|
||||
if ($DAT{'nm'} ne "$host") {
|
||||
push(@new,"$time<>$DAT{'nm'}<>$addr<>\n");
|
||||
$member .= (!$flag2) ? "$DAT{'nm'} [IN]◇" : "$DAT{'nm'} [IN]◆";
|
||||
}
|
||||
}
|
||||
# 参加者数を認識
|
||||
$num = @new;
|
||||
|
||||
# ファイル更新
|
||||
open(OUT,">$memfile") || &error("Write Error : $memfile");
|
||||
eval "flock(OUT,2);";
|
||||
truncate(OUT,0);
|
||||
seek(OUT,0,0);
|
||||
print OUT @new;
|
||||
close(OUT);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# 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";
|
||||
<META HTTP-EQUIV="refresh" CONTENT="$reload_time[$rd];URL=$script?id=$id&pw=$pw&rd=$rd">
|
||||
$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>" ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user