#! /usr/local/bin/perl ############################################ #BooTreeBBS,v1.08 / This program for Admin.# #(C) BooBooClub 1999-2005 # ############################################ #set data $bbs = './btbbs.cgi'; $dat = './bdata.dat'; $adcgi = './btadmin.cgi'; $pass = 'pass'; $head = 'This page is exclusively for Admin'; $back = 'bgcolor="#ffffff"'; $linkc = 'text="#000000" link="#0000ff" vlink="#880088"'; $rmnews = 'Admin Removed'; #read_lib require './jcode.pl'; #read if ($ENV{'REQUEST_METHOD'} eq "POST"){ read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else{ $buffer = $ENV{'QUERY_STRING'}; } @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/\r\n|[\r\n]//ig; $value =~ s/\,//g; $value =~ s//>/ig; &jcode'convert(*value,'sjis'); $FORM{$name} = $value; } #branch if ($FORM{'submit'} ne 'Remove') { &lock; &html; } else { ✓ &html; } sub check { if ($FORM{'pass'} eq $pass) { &lock; &remove; } else { &error; } } sub lock { $lockfile = './lock/lockfile'; #lock check $retry = 1; until (symlink("$dat", "$lockfile")){ if (++$retry >= 30){ unlink("$lockfile"); exit(0); } sleep(1); } } sub remove { open(DAT,"$dat"); @bdats = ; close(DAT); foreach $odat (@bdats) { ($re,$name,$mail,$title,$txt,$time) = split(/,/,$odat); chomp $time; if($FORM{'remove'} ne $time){ push(@ndat,$odat); } else{ $cdat = "$re,$name,$mail,$rmnews,このメッセージは削除されました。,$time\n"; push(@ndat,$cdat); } } open(DAT,">$dat"); print DAT @ndat; close(DAT); } sub error { print "Content-type: text/html\n\n"; print "pass error\n"; print "\n"; print "

Connection error!

\n"; print "不正なパスワードです。


\n"; print "
\n"; exit 0; } sub html { open(DAT,"$dat"); @rdats = ; close(DAT); print "Content-type: text/html\n\n"; print "For Admin\n"; print "\n"; print "
$head

\n"; print "
"; print "
\n"; print "Password:  \n"; print "Go to BBS

"; print "\n"; print "

\n"; foreach $rdat (@rdats) { ($re,$name,$mail,$title,$txt,$time) = split(/,/,$rdat); chomp $time; print ""; if ($title eq $rmnews){ print ""; print "Removed \n"; print "Time=$time\   Name\=$name\    Title\="; if ($re ne 0){ print "Re"; if ($re >= 2){ print "[$re]"; } print ": "; } print "$title\
\n"; print "
"; } else{ print "Remove? \n"; print "Time=$time\   Name\=$name\    Title\="; if ($re ne 0){ print "Re"; if ($re >= 2){ print "[$re]"; } print ": "; } print "$title\
\n"; } } print "

\n"; print "
\n"; print "\n"; } unlink("$lockfile"); exit 0;