⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 delpost.cgi

📁 一个linux论坛
💻 CGI
📖 第 1 页 / 共 4 页
字号:
#!/usr/bin/perl
#############################################################
#  LeoBoard ver.5000 / LB5000 / 雷傲超级论坛 ver.5000
#
#  版权所有: 雷傲工作室(原蓝宝石软件工作室)
#
#  制作人  : 山鹰糊 (Shining Hu)
#            花无缺 (Ifairy Han)
#
#  主页地址: http://www.CGIer.com/      CGI 编程者之家
#	     http://www.LeoBoard.com/   雷傲论坛支持主页
#	     http://www.leoBBS.com/     本论坛直通车
#
#############################################################
BEGIN {
    $start_time = (times)[0] + (times)[1];
    $LBPATH = '.';
    my $pgm = $0;
    $pgm =~s/\\/\//g;
    $pgm =~s/^.*\/([^\/]+)$/$1/g;
    unless (-e $LBPATH.'/'.$pgm) {
        foreach ($0, $ENV{'SCRIPT_FILENAME'}, $ENV{'PATH_TRANSLATED'}) {
            s!\\!/!g; s/^(.*)\/[^\/]+$/$1/g;
            if (-e $_ . '/' .$pgm) { $LBPATH = $_; last; }
        }
    }
    unshift (@INC, "$LBPATH");
}
use LBCGI;
use File::Copy;
$LBCGI::DISABLE_UPLOADS = 1;
$LBCGI::HEADERS_ONCE = 1;
$LBCGI::POST_MAX=1024 * 150;
require "code.cgi";
require "data/boardinfo.cgi";
require "data/styles.cgi";
require "lb.lib.pl";
require "rebuildlist.pl";

$|++;
$thisprog = "delpost.cgi";
$query = new LBCGI;

&ipbanned; #封杀一些 ip

$addme=$query->param('addme');
if ($arrowavaupload ne "on") { undef $addme; }
for ('forum','topic','membername','password','action','postno',
     'notify','deletepost','inpost','checked','movetoid','leavemessage','posticon') {
    next unless defined $_;
    next if $_ eq 'SEND_MAIL';
    $tp = $query->param($_);
    $tp = &cleaninput("$tp");
    ${$_} = $tp;
}
$inforum       = $forum;
$intopic       = $topic;
&error("打开文件&老大,别乱黑我的程序呀!") if (($intopic) && ($intopic !~ /^[0-9 ]+$/));
&error("打开文件&老大,别乱黑我的程序呀!") if ($inforum !~ /^[0-9 ]+$/);
$inmembername  = $membername;
$inpassword    = $password;
$inpostno      = $postno;
@inpostno      = split(/ /,$inpostno); 
$inpostno      = ~ s/ //g; 
$indeletepost  = $deletepost;
$inleavemessage= $leavemessage;
$currenttime   = time;
$inposticon	= $posticon;

if (-e "${lbdir}data/style${inforum}.cgi") { require "${lbdir}data/style${inforum}.cgi"; }
print header(-charset=>gb2312);
if (($inpostno) && ($inpostno !~ /^[0-9]+$/)) { &error("普通错误&请不要修改生成的 URL!"); }

if (! $inmembername) { $inmembername = $query->cookie("amembernamecookie"); }
if (! $inpassword) { $inpassword = $query->cookie("apasswordcookie"); }
$inmembername =~ s/[\a\f\n\e\0\r\t\`\~\!\@\#\$\%\^\&\*\(\)\+\=\\\{\}\;\'\:\"\,\.\/\<\>\?]//isg;
$inpassword =~ s/[\a\f\n\e\0\r\t\|\@\;\#\{\}\$]//isg;

if ($inmembername eq "" || $inmembername eq "客人" ) {
    $inmembername = "客人";
} else {
    &getmember("$inmembername");
#    &getmembernolock("$inmembername");
    &error("普通错误&此用户根本不存在!") if ($userregistered eq "no");
    &error("普通错误&密码与用户名不相符,请重新登录!") if ($inpassword ne $password);
}
$cpudisp = 1 if (($membercode eq "ad")||($membercode eq "smo")||($membercode eq "cmo"));
#&getoneforum("$inforum");
&moderator("$inforum");

my %Mode = (
    'delete'      =>    \&deletethread,
    'movetopic'   =>    \&movetopic,
);
if ($Mode{$action}) { $Mode{$action}->(); }
elsif ($action eq "processedit" && $indeletepost eq "yes") { &deletepost;   }
elsif ($action eq "directdel") {&deletepost}
else { &error("普通&请以正确的方式访问本程序"); }

&output( -Title => $boardname, -ToPrint => $output, -Version => $versionnumber );
exit;
    
sub deletethread {
    &mischeader("删除主题");
    $cleartoedit = "no";
    if (($membercode eq "ad")  && ($inpassword eq $password)) { $cleartoedit = "yes"; }
    if (($membercode eq 'smo') && ($inpassword eq $password)) { $cleartoedit = "yes"; }
    if (($inmembmod eq "yes")  && ($inpassword eq $password)) { $cleartoedit = "yes"; }
    $alldeltopic = 0;

    if ($membercode ne "ad"){ 
        $maxdeloneday = 9 if (($maxdeloneday eq "")||($maxdeloneday <= 0));
        open(FILE,"${lbdir}data/baddel.cgi"); 
        my @delfile = <FILE>; 
        close(FILE); 
        my $delcount=0; 
        my $delcou=0; 
        my $totime=time-24*3600;
        foreach (@delfile){ 
	    chomp $_; 
	    (my $delname, my $no, my $noip, $no, $no ,my $notime) = split(/\t/,$_); 
	    if (lc($delname) eq lc($inmembername)){ 
	        if ($notime > $totime){ 
	            $delcount++; 
	        } 
	    } 
	    if ($noip eq "$ENV{'REMOTE_ADDR'}"){ 
	        if ($notime > $totime){ 
	            $delcou++; 
	        }
	    }
        }
        if ($delcount > $maxdeloneday){ &error("删除主题&你今天删除帖子太多,请明天继续!"); } 
        if ($delcou > $maxdeloneday)  { &error("删除主题&你今天删除帖子太多,请明天继续!"); } 
        undef $delcount; 
        undef $delcou; 
    }

    if ($checked eq "yes"){ #1
        @intopic=split(/ /,$intopic);
        $alldeltopic=@intopic;
        foreach $intopic (@intopic) {#2
            $filetoopen = "${lbdir}forum$inforum/$intopic.thd.cgi";
            if (!(-e $filetoopen)) { $alldeltopic -- ; }
    	    else { #3
		open(FILE, "$filetoopen");
		@threads = <FILE>;
		close(FILE);

	    	($startedby, $topictitle, my $no, $no, $no ,$no, $no, $no, $no, $no) = split(/\t/,$threads[0]);
        	if ($arrowuserdel eq "on") {
            	    if ((lc($inmembername) eq lc($startedby)) && ($inpassword eq $password)) { $cleartoedit = "yes"; }
        	}
		unless ($cleartoedit eq "yes") { $cleartoedit = "no"; }

        	if ($cleartoedit eq "no") { &error("删除主题&您不是本论坛坛主或版主,也不是本主题的发布者,或者您的密码错误!"); }
        	else {#4
	  	    $nametocheck = $startedby;
	  	    $nametocheck =~ s/ /\_/g;
	  	    $nametocheck =~ tr/A-Z/a-z/;
	  	    $nametocheck = &stripMETA($nametocheck);
	  	    my $filetoopen = "${lbdir}$memdir/$nametocheck.cgi";
	  	    $filetoopen = "${lbdir}$memdir/old/$nametocheck.cgi" if (!(-e $filetoopen));
	  	    if (-e $filetoopen) {#6
	    		&winlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
	    		open(FILE,"$filetoopen");
	    		flock (FILE, 1) if ($OS_USED eq "Unix");
            		my $filedata = <FILE>;
            		close(FILE);
	    		chomp $filedata;
	    		(my $membername, my $password, my $membertitle, my $membercode, my $numberofposts, my $emailaddress, my $showemail, my $ipaddress, my $homepage, my $oicqnumber, my $icqnumber ,my $location ,my $interests, my $joineddate, my $lastpostdate, my $signature, my $timedifference, my $privateforums, my $useravatar, my $misc1,my  $userxz, my $usersx, my $personalavatar, my $personalwidth, my $personalheight, my $rating, my $lastgone, my $visitno,my  $addjy,my  $meili, my $mymoney, my $postdel, my $sex, my $education, my $marry, my $work, my $born, my $chatlevel, my $chattime, my $jhmp,my $useradd3, my $useradd4, my $onlinetime,my $userquestion, my $useradd6, my $useradd7, my $useradd8 ) = split(/\t/,$filedata);
	  		if (($membername ne "")&&($password ne "")) {#7
	    		    open(FILE,">$filetoopen");
	    		    flock (FILE, 2) if ($OS_USED eq "Unix");
	    		    $lastgone=time;
	    		    $postdel ++ if ($inleavemessage eq "yes");
	    		    print FILE "$membername\t$password\t$membertitle\t$membercode\t$numberofposts\t$emailaddress\t$showemail\t$ipaddress\t$homepage\t$oicqnumber\t$icqnumber\t$location\t$interests\t$joineddate\t$lastpostdate\t$signature\t$timedifference\t$privateforums\t$useravatar\t$userflag\t$userxz\t$usersx\t$personalavatar\t$personalwidth\t$personalheight\t$rating\t$lastgone\t$visitno\t$addjy\t$meili\t$mymoney\t$postdel\t$sex\t$education\t$marry\t$work\t$born\t$chatlevel\t$chattime\t$jhmp\t$useradd3\t$useradd4\t$onlinetime\t$userquestion\t$useradd6\t$useradd7\t$useradd8\t\n";
	    		    close(FILE);
	  		}#7
	    		&winunlock($filetoopen) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
	  	    }#6

		    $postcount = @threads;
        	    $postcount--;
		    $alldelpost=$postcount+$alldelpost;

        	    unlink ("${lbdir}forum$inforum/$intopic.pl");
        	    unlink ("${lbdir}forum$inforum/$intopic.thd.cgi");
        	    unlink ("${lbdir}forum$inforum/$intopic.poll.cgi");
        	    unlink ("${lbdir}forum$inforum/$intopic.mal.pl");
        	    unlink ("${lbdir}forum$inforum/rate$intopic.file.pl");
        	    unlink ("${lbdir}forum$inforum/rateip$intopic.file.pl");

		    opendir (DIRS, "${imagesdir}usr/$inforum");
		    my @files = readdir(DIRS);
		    closedir (DIRS);
		    my @files = grep(/^$inforum\_$intopic/i, @files);

		    my @files1 = grep(/^$inforum\_$intopic./i, @files);
		    foreach (@files1) {
		        chomp $_;
		        unlink ("${imagesdir}usr/$inforum/$_");
    		    }

    		    my @files1 = grep(/^$inforum\_$intopic\_/i, @files);
    		    foreach (@files1) {
    		        chomp $_;
		        unlink ("${imagesdir}usr/$inforum/$_");
    		    }
	        }#4
	    }#3
	}#2

        if ($alldeltopic > 6){
	    $trueipaddress = $ENV{'HTTP_X_FORWARDED_FOR'};
	    $trueipaddress = "no" if (($trueipaddress eq "")||($trueipaddress eq "unknown"));
	    my $trueipaddress1 = $ENV{'HTTP_CLIENT_IP'};
	    $trueipaddress = $trueipaddress1 if (($trueipaddress1 ne "")&&($trueipaddress1 ne "unknown"));
	    my $thistime=time;
            if (open(FILE, ">>${lbdir}data/baddel.cgi")) {
                print FILE "$inmembername\t密码不显示\t$ENV{'REMOTE_ADDR'}\t$trueipaddress\t删除$forumname $alldeltopic 个贴子\t$thistime\t\n";
                close(FILE);
            }
            undef $thistime;
        }

    if ($cleartoedit eq "no")  { &error("删除主题&您不是本论坛坛主或版主,也不是本主题的发布者,或者您的密码错误!"); }
    if ($cleartoedit eq "yes") {
       	undef @sortdat;
	$file = "$lbdir" . "boarddata/list$inforum.cgi";
        &winlock($file) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
        open (LIST, "$file");
        flock (LIST, 1) if ($OS_USED eq "Unix");
        @listall=<LIST>;
        close (LIST);
        &winunlock($file) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
	$listall = @listall;
        if ($listall >= 200) {
            &winlock($file) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));
            if (open (LIST, ">$file")) {
            flock (LIST, 2) if ($OS_USED eq "Unix");
            foreach (@listall) {
		($listone, $noneed) = split(/\t/,$_);
		next if ($listone !~ /^[0-9]+$/);
		my $checkme=0;
		foreach $intopic (@intopic){
		    if ($listone eq $intopic) {
			$checkme=1;
		    }
		}
		if ($checkme ==0){
		print LIST "$_";
		push(@sortdat, $_);
		}
	    }
	    close (LIST);
	    }
	    &winunlock($file) if (($OS_USED eq "Unix")||($OS_USED eq "Nt"));

	}
	else {
	    rebuildLIST(-Forum=>"$inforum");
	}

	$filetomakeopen = "$lbdir" . "data/recentpost.cgi";
	&winlock($filetomakeopen) if ($OS_USED eq "Nt");
	open(FILE, "$filetomakeopen");
	flock (FILE, 1) if ($OS_USED eq "Unix");
	@recentposts=<FILE>;
	close(FILE);
	if (open (FILE, ">$filetomakeopen")) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -