#! /usr/local/bin/perl ######################################## #BooBBS,v2.40 / This program for Admin.# #(C) BooBooClub 1998-2006 # ######################################## #set data $bbs = './bbbs.cgi'; $admin = './badmin.cgi'; $dat = './bdata.dat'; $id = 'id'; $pwd = 'pass'; $head = 'This page is exclusively for Admin'; $back = 'bgcolor="#ffffff"'; $linkc = 'text="#000000" link="#0000ff" vlink="#880088"'; #read lib require 'jcode.pl'; #lock check $lockfile = './lock/lockfile'; $retry = 1; until(symlink("$dat", "$lockfile")){ if(++$retry >= 30){ unlink("$lockfile"); exit 0; } sleep(1); } #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'); if($name eq 'remove'){ $FORM{$name} .= ','.$value; } else{ $FORM{$name} = $value; } } @remove = split(/,/,$FORM{'remove'}); #branch if($FORM{'submit'} ne 'Remove'){ &html; } else{ ✓ &html; } sub check{ if($FORM{'id'} eq $id && $FORM{'pwd'} eq $pwd){ &remove; } else{ &error; } } sub remove{ open(DAT,"$dat"); @bdats = ; close(DAT); foreach $odat(@bdats){ ($name,$mail,$title,$txt,$time) = split(/,/,$odat); $oltime = $time; chomp $oltime; $i = 0; foreach $rltime(@remove){ if($oltime eq $rltime){ $i++; } } if($i == 0){ push(@ndat,$odat); } } open(DAT,">$dat"); print DAT @ndat; close(DAT); } sub error{ print "Content-type: text/html\n\n"; print "Password Error\n"; print "\n"; print "

Password Error!

\n"; print "パスワードが間違っています。


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

$head

\n"; print "
Back to BBS
\n"; print "
\n"; print "
\n"; print "   ID   :

\n"; print "Password:

\n"; print "\n"; print "\n"; print "
\n"; foreach $rdat(@rdats){ ($name,$mail,$title,$txt,$otime) = split(/,/,$rdat); chomp $otime; print "
\n"; print "\n"; print "$otime\  Name\=$name\  Title\=$title\n"; } print "

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