Files
ore/hist.cgi
T

217 lines
5.9 KiB
Perl
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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 = "./hist.cgi"; # このスクリプトのパス
$logfile = "./logdata/hist_log.cgi"; # ログファイルのパス
#-------------------------------------------------------------------------------
# 環境設定
$title = "과거의 영광"; # タイトル名
$maxlog = 60; # 最大記録行数
# 機種別設定
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用設定
$log_last= 50; # 表示行数(PC)
# BODYタグ装飾
$body = 'bgcolor="#111122" text="#ddddee" link="#ffddee" vlink="#ffddee" alink="#ffddee" style="font-size:14px"';
}
#===============================================================================
# 以下処理 基本的にこれ以下はいじらないように。
#-------------------------------------------------------------------------------
# メイン処理
&axs_check;
&decode_hist;
$ore_game_ =($mode eq 'guest') ? $index : $ore_game ;
&html;
#-------------------------------------------------------------------------------
# 記事表示部
sub html {
# 表示開始
&header;
if($mv_mode eq 'mv'){
print <<"EOM";
<b>$title</b>
<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="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");
my @lines = <IN>;
close(IN);
# 行数調整
if($#lines > $maxlog){
foreach(0 .. $#lines-$maxlog){ shift(@lines); }
}
open (OUT,">$logfile") || &error("open error:$logfile");
print OUT @lines;
close(OUT) or die "Can't close : $!";
# 記事展開
@lines = reverse(@lines);
foreach(0 .. $log_last){
last if(!$lines[$_]);
my @y1 = split(/,/,$lines[$_]);
$y1[43] =~ s/wr_mes;//g;
if($mv_mode eq 'pc'){
foreach(1 .. $#camp_info){
$y1[43] =~ s/$camp_info[$_][0]/<span style="color:$camp_info[$_][1]">$camp_info[$_][0]<\/span>/g;
}
}
print "<li>$y1[43]<hr>\n";
}
# 著作権表示(削除禁止)
print "<hr>\n";
&copyright;
exit;
}
#-------------------------------------------------------------------------------
# デコード処理
sub decode_hist {
local($buffer, @pairs, $name, $value);
$post_flag=0;
if($ENV{'REQUEST_METHOD'} eq "POST"){
$post_flag=1;
&error("전송량이 너무 많습니다") if($ENV{'CONTENT_LENGTH'}>8192);
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}else{
$buffer = $ENV{'QUERY_STRING'};
&error("전송량이 너무 많습니다") if(length($buffer)>7500)
}
@pairs = split(/&/, $buffer);
foreach (@pairs) {
($name,$value) = split(/=/);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# 荒らし処理 1
$value =~ s/(<br>){4,}//g;
$value =~ s/( | ){6,}//g;
$value =~ s/\r//g;
$value =~ s/\n//g;
# 記号置換え 1
$value =~ s/\s/&nbsp;/g;
$value =~ s/</&lt;/g;
$value =~ s/>/&gt;/g;
$value =~ s/\"/&quot;/g;
# 記号置換え 2
$value =~ s/\?/&#63\;/g;
$value =~ s/,/&#44\;/g;
$value =~ s/'/&#39\;/g;
$value =~ s/`/&#96\;/g;
$value =~ s/\;/&#59\;/g;
$value =~ s/\\/&#92\;/g;
$value =~ s/\|/&#124\;/g;
$value =~ s/\//&#47\;/g;
$value =~ s/\./&#46\;/g;
# 文字コードをシフトJIS変換
# &jcode'convert(*value, "sjis", "", "z");
$in{$name} = $value;
}
$pw = $in{'pw'}; if(length($in{'pw'})>8) { &error("글자 수 오류입니다 3"); }
$id = $in{'id'}; if(length($in{'id'})>24) { &error("글자 수 오류입니다 4"); }
if ($base_url) {
$ref_url = $ENV{'HTTP_REFERER'};
$ref_url =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if ($ref_url !~ /$base_url/i) { &error("올바르지 않은 접근입니다"); }
}
}
#-------------------------------------------------------------------------------
# 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
print "$css" if($mv_mode eq 'pc');
print "</head>\n<body $body>\n";
}