#!/usr/bin/perl #  ############################################ # BBS Lite v2.1 # by Hiroyuki Koike # ninja@osk.threewebnet.or.jp # # Copyright 1996, All Rights Reserved # # This script and others available at # # # last modify ; Jan 23 1997 ############################################ # これは、鑑定!チェックCGIに組み込むため改造したものです。 # # 改造者 Copyright (C) 2000 giga/All right reserved. # http://giga.pos.to/ # ############################################ #★マークは必ず変えましょうね # タイトル★ $title = 'いわき市民度鑑定!結果'; # 名前の色指定 $namecolor = '#ffaa77'; # 文字色を指定 $textcolor = "#000000"; # 背景色を指定 $bgcolor = "#fffff8"; # 最大書き込み件数(これを越えるログは残りません) $of_mess = "50"; #■ここまで■ ##################################### require 'jcode.pl'; $file = "checklog.dat"; # 日付の所得 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); if ($sec < 10) { $sec = "0$sec"; } if ($min < 10) { $min = "0$min"; } if ($hour < 10) { $hour = "0$hour"; } $month = ($mon + 1); $y0="日"; $y1="月"; $y2="火"; $y3="水"; $y4="木"; $y5="金"; $y6="土"; $youbi = ($y0,$y1,$y2,$y3,$y4,$y5,$y6) [(localtime)[6]]; $date_now = "$month月$mday日($youbi)$hour時$min分"; print "Content-type: text/html\n\n"; if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } if ($buffer eq "") { &html; } else { &parse; &modify; &html; } sub html { open(DB,"$file") || die "Cannot Open File $file: $!"; @ines = ; close(DB); print "$title\n"; print "\n"; print "
$title
(最新$of_mess件)
\n"; print "$messages \n"; foreach $line (@ines) { if ($line =~ /\[(.*)\] (.*) \^ (.*) \^ (.*)/) { $date = $1; $a_name = $2; $data = $3; $comment = $4; print "
$a_name [結果:$data] "; print "$date

\n"; print "

$comment
\n"; } } print "
このCGIはWeb忍法帖で配布されているBBS Lite v2.1をJUNK HUNTで鑑定!チェックCGI用に改造したものです。"; } sub modify { $id = $ENV{'REMOTE_HOST'}; open(LOG,"$file") || die "Can't Open File: $!\n"; @lines=; close(LOG); $axs=@lines; $of_mess2 = ($of_mess - 2); open(LOG,">$file") || die "Can't Open File: $!\n"; print LOG "[$date_now] $a_name \^ $data \^ $comment\n"; if ($axs >= $of_mess) { foreach $axs (0..$of_mess2) { print LOG $lines[$axs]; } } else { foreach (@lines) { print LOG; } } close(LOG); } sub error1 { print "$title\n"; print "\n"; print "

$title

\n"; print "名前が入力されていません。\n"; print "


\n"; print "\n"; exit; } sub error2 { print "$title\n"; print "\n"; print "

$title

\n"; print "文章が入力されていません。\n"; print "


\n"; print "\n"; exit; } sub parse { @pairs = split(/&/,$buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s//
/ig; $value =~ s/\n//g; $value =~ s/^//g; &jcode'h2z_sjis(*value);#半角を全角に変換 &jcode'convert(*value,'sjis'); # 日本語コードをsjisに統一 $FORM{$name} = $value; } $a_name = $FORM{'author'}; $comment = $FORM{'comment'}; $data = $FORM{'data'}; if ($a_name eq "") { &error1; } if ($comment eq "") { &error2; } }