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

📄 setforums.cgi

📁 一个linux论坛
💻 CGI
📖 第 1 页 / 共 5 页
字号:
 	    open (FILE,">$imagesdir/myimages/$up_name.$up_ext");
		binmode (FILE);
		while ($buffer=$query->readUploadFile($addme,4096)) {
		        $buffer=~s/\.cookie/\&\#46\;cookie/isg;
			$buffer =~ s/on(mouse|exit|error|click|key)/\&\#111\;n$1/isg;
			$buffer=~s/script/scri\&\#112\;t/isg;
        		$buffer =~ s/style/\&\#115\;tyle/isg;
		print FILE $buffer;
	    }
	    close (FILE);
        if ($up_ext eq "gif"||$up_ext eq "jpg"||$up_ext eq "bmp"||$up_ext eq "jpeg"||$up_ext eq "png"||$up_ext eq "ppm"||$up_ext eq "svg"||$up_ext eq "xbm"||$up_ext eq "xpm") {
    	    my $info = image_info("${imagesdir}myimages/$up_name.$up_ext");
	    if ($info->{error} eq "Unrecognized file format"){
                unlink ("${imagesdir}myimages/$up_name.$up_ext");
                &errorout("上传出错&上传文件不是图片文件,请上传标准的图片文件!");
            }
            undef $info;
       }
	}

                $filetoopen = "$lbdir" . "data/allforums.cgi";
	        &winlock($filetoopen) if ($OS_USED eq "Nt");
                open(FILE, "$filetoopen");
  	        flock(FILE, 1) if ($OS_USED eq "Unix");
                @forums = <FILE>;
                close(FILE);
	        &winunlock($filetoopen) if ($OS_USED eq "Nt");

                # Create a new number for the new forum folder, and files.

                foreach (@forums) {
                    ($forumid, $binit) = split(/\t/,$_);
                    if ($forumid > $high) { $high = $forumid; }
                    }

                $high++;

                $newforumid = $high;


                # Lets create the directory.

                $dirtomake = "$lbdir" . "forum$newforumid";
                mkdir ("$dirtomake", 0777);

                $dirtomake1 = "$imagesdir" . "usr/$newforumid";
                mkdir ("$dirtomake1", 0777);

                $filetomake = "$dirtomake1/index.html";
                open(FILE,">$filetomake");
                print FILE "-";
                close(FILE);

                # Lets add a file to stop snoops, and to use to see if the forum was created

                $filetomake = "$dirtomake/index.html";
                open(FILE,">$filetomake");
                print FILE "-";
                close(FILE);

                $filetomake = "$lbdir" . "boarddata/list$newforumid.cgi";
                open(FILE,">$filetomake");
                close(FILE);

                $filetomake = "$dirtomake/.htaccess";
                open(FILE, ">$filetomake");
                print FILE "AuthUserFile /dev/null\n";
                print FILE "AuthGroupFile /dev/null\n";
                print FILE "AuthName DenyViaWeb\n";
                print FILE "AuthType Basic\n";
                print FILE "\n\n\n\n";
                print FILE "<Limit GET>\n";
                print FILE "order allow,deny\n";
                print FILE "deny from all\n";
                print FILE "</Limit>\n";
                close (FILE);

my @molist = split(/\,/,$new_forummoderator);
foreach $_ (@molist){
    chomp $_;
    $_ =~ s/ /\_/g;
    $_ =~ tr/A-Z/a-z/;
    next if ($_ eq "");
    next if (($_ =~ /诚聘中/i)||($_ =~ /斑竹/i)||($_ =~ /全体管理人员/i)||($_ =~ /管理员/i)||($_ =~ /暂时空缺/i)||($_ =~ /版主/i)||($_ =~ /坛主/i));
    if ((!(-e "${lbdir}$memdir/$_.cgi"))&&(!(-e "${lbdir}$memdir/old/$_.cgi"))) { &winunlock($filetoopen) if ($OS_USED eq "Nt"); &errorout("论坛版主名单中,$_ 这个用户 ID 是不存在的!");}
}

                $filetomake1 = "$dirtomake/foruminfo.cgi";
                open(FILE,">$filetomake1");
                print FILE "$newforumid\t$new_categoryname\t$new_categorynumber\t$new_forumname\t$new_forumdescription\t$new_forummoderator\t$new_htmlstate\t$new_idmbcodestate\t$new_privateforum\t$new_startnewthreads\t\t\t0\t0\t$new_forumgraphic\t$new_ratings\t$misc\t$new_forumpass\t$new_hiddenforum\t$new_indexforum\t$new_teamlogo\t$new_teamurl\t$new_fgwidth\t$new_fgheight\t$new_miscadd3\t$new_miscadd4\t$new_miscad5\t";
                close(FILE);

                $filetoopen = "$lbdir" . "data/allforums.cgi";
		&winlock($filetoopen) if ($OS_USED eq "Nt");
                open(FILE, "$filetoopen");
	        flock(FILE, 1) if ($OS_USED eq "Unix");
                @forums = <FILE>;
                close(FILE);

                open(FILE, ">$filetoopen");
                flock(FILE, 2) if ($OS_USED eq "Unix");
                foreach $line (@forums) {
                    chomp $line;
                    ($tempforumno,undef,$tempcategorynumber)=split(/\t/,$line);
                    print FILE "$line\n";
                    if($new_categoryname =~/childforum-[0-9]+/){
                print FILE "$newforumid\t$new_categoryname\t$new_categorynumber\t$new_forumname\t$new_forumdescription\t$new_forummoderator\t$new_htmlstate\t$new_idmbcodestate\t$new_privateforum\t$new_startnewthreads\t\t\t0\t0\t$new_forumgraphic\t$new_ratings\t$misc\t$new_forumpass\t$new_hiddenforum\t$new_indexforum\t$new_teamlogo\t$new_teamurl\t$new_fgwidth\t$new_fgheight\t$new_miscadd3\t$new_miscadd4\t$new_miscad5\t\n" if($new_categoryname eq "childforum-$tempforumno");
                $Get=1;
                    }
                    }
                print FILE "$newforumid\t$new_categoryname\t$new_categorynumber\t$new_forumname\t$new_forumdescription\t$new_forummoderator\t$new_htmlstate\t$new_idmbcodestate\t$new_privateforum\t$new_startnewthreads\t\t\t0\t0\t$new_forumgraphic\t$new_ratings\t$misc\t$new_forumpass\t$new_hiddenforum\t$new_indexforum\t$new_teamlogo\t$new_teamurl\t$new_fgwidth\t$new_fgheight\t$new_miscadd3\t$new_miscadd4\t$new_miscad5\t\n" if($new_categoryname !~/childforum-[0-9]+/);
                close(FILE);
	        &winunlock($filetoopen) if ($OS_USED eq "Nt");

                print qq~
                <tr><td bgcolor=#333333" colspan=2><font color=#FFFFFF>
                <b>欢迎来到论坛管理中心 / 增加论坛结果</b>
                </td></tr>
                <tr>
                <td bgcolor=#FFFFFF colspan=2>
                <font color=#333333>
                ~;

                print "<b>详细资料</b><p>\n";
                print "<ul>\n";
                if (-e $dirtomake) {
                print "<li><b>新论坛目录已经建立</b><p>\n";
                    }
                    else {
                        print "<li><b>新论坛目录没有建立</b><p>请查看是否改变了目录属性?请改属性回 777 !<p>\n";
                        }


                $filetoopen = "$dirtomake/index.html";
                if (-e $filetoopen) {
                    print "<li><b>新论坛 (index.html) 文件建立</b><p>\n";
                    }
                    else {
                        print "<li><b>新论坛 (index.html) 文件没有建立</b><p>请查看是否改变了目录属性?请改属性回 777 !\n";
                        }
                print "$filetoopen<p>\n";
                print "</ul></td></tr></table></td></tr></table>\n";

} ######## end routine

sub warning {
    print qq~<tr><td bgcolor=#333333" colspan=2><font color=#FFFFFF><b>欢迎来到论坛管理中心 / 删除论坛</b></td></tr>
<tr><td bgcolor=#EEEEEE align=center colspan=2><font color=#990000><b>警告!!</b></td></tr>
<tr><td bgcolor=#FFFFFF align=center colspan=2><font color=#333333>如果您确定要删除论坛,那么请点击下面链接<p>
>> <a href="$thisprog?action=delete&checkaction=yes&forum=$inforum">删除论坛以及论坛下的所有文件</a> <<
</td></tr></table></td></tr></table>
~;
}

sub deleteforum { #start
    my $thistime=time;
    open(FILE, ">>${lbdir}data/baddel.cgi");
    print FILE "$inmembername\t密码不显示\t$ENV{'REMOTE_ADDR'}\t$ENV{'HTTP_X_FORWARDED_FOR'}\t删除论坛$forumname\t$thistime\t\n";
    close(FILE);
    undef $thistime;

    opendir (DIRS, "${imagesdir}usr/$inforum");
    my @files = readdir(DIRS);
    closedir (DIRS);
    foreach (@files) {
    	chomp $_;
	unlink ("${imagesdir}usr/$inforum/$_");
    }
    unlink ("${imagesdir}usr/$inforum/.htaccess");
    rmdir ("${imagesdir}usr/$inforum");

    opendir (DIRS, "${lbdir}forum$inforum");
    my @files = readdir(DIRS);
    closedir (DIRS);
    foreach (@files) {
    	chomp $_;
	unlink ("${lbdir}forum$inforum/$_");
    }
    unlink ("${lbdir}forum$inforum/.htaccess");
    rmdir ("${lbdir}forum$inforum");

    unlink ("${lbdir}data/news$inforum.cgi");
    unlink ("${lbdir}data/style$inforum.cgi");
    unlink ("${lbdir}boarddata/list$inforum.cgi");
    unlink ("${lbdir}boarddata/xzb$inforum.cgi");
    unlink ("${lbdir}boarddata/xzbs$inforum.cgi");
    unlink ("${lbdir}boarddata/lastnum$inforum.cgi");
    unlink ("${lbdir}boarddata/ontop$inforum.cgi");
    unlink ("${lbdir}boarddata/jinghua$inforum.cgi");
    unlink ("${lbdir}boarddata/recyclebin$inforum.cgi");

    $filetoopen = "$lbdir" . "data/allforums.cgi";
    &winlock($filetoopen) if ($OS_USED eq "Nt");
    open(FILE,"$filetoopen");
    flock(FILE, 1) if ($OS_USED eq "Unix");
    my @forums = <FILE>;
    close(FILE);

    open(FILE,">$filetoopen");
    flock(FILE,2) if ($OS_USED eq "Unix");
    foreach (@forums) {
        chomp $_;
	my ($forumid, $category, $categoryplace, $forumname, $forumdescription, $forummoderator ,$htmlstate ,$idmbcodestate ,$privateforum, $startnewthreads ,$lastposter ,$lastposttime, $threads, $posts, $forumgraphic, $ratings, $misc,$forumpass,$hiddenforum,$indexforum,$teamlogo,$teamurl, $fgwidth, $fgheight, $miscadd3, $miscadd4, $miscad5) = split(/\t/,$_);
    	next if ($forumid !~ /^[0-9]+$/);
	if ($forumid ne $inforum) {
            print FILE "$_\n";
        }
        else { $thdcount = $threads; $threadcount = $posts; }
    }
    close(FILE);
    &winunlock($filetoopen) if ($OS_USED eq "Nt");
    
    $threadcount = 0 if ($threadcount eq "");
    $thdcount    = 0 if ($thdcount eq "");

    require "$lbdir" . "data/boardstats.cgi";
    $totalthreads = $totalthreads - $thdcount;
    $totalposts   = $totalposts   - $threadcount;

    $filetomake = "$lbdir" . "data/boardstats.cgi";
    &winlock($filetomake) if ($OS_USED eq "Nt");
    open(FILE, ">$filetomake");
    flock(FILE, 2) if ($OS_USED eq "Unix");
    print FILE "\$lastregisteredmember = \'$lastregisteredmember\'\;\n";
    print FILE "\$totalmembers = \'$totalmembers\'\;\n";
    print FILE "\$totalthreads = \'$totalthreads\'\;\n";
    print FILE "\$totalposts = \'$totalposts\'\;\n";
    print FILE "\n1\;";
    close (FILE);
    &winunlock($filetomake) if ($OS_USED eq "Nt");

    print qq~<tr><td bgcolor=#333333" colspan=2><font color=#FFFFFF><b>欢迎来到论坛管理中心 / 删除论坛结果</b></td></tr>
<tr><td bgcolor=#FFFFFF colspan=2><font color=#990000>
<center><b>论坛已被删除</b></center><p>
共有 $thdcount 主题被删除<p>
共有 $threadcount 回复被删除<p>
</td></tr></table></td></tr></table>
~;
}

sub editform {

         $filetoopen = "$lbdir" . "data/allforums.cgi";
         &winlock($filetoopen) if ($OS_USED eq "Nt");
         open(FILE,"$filetoopen");
         flock(FILE, 1) if ($OS_USED eq "Unix");
         @forums = <FILE>;
         close(FILE);
         &winunlock($filetoopen) if ($OS_USED eq "Nt");


         foreach $forum (@forums) {
            chomp $forum;
	    next if ($forum eq "");
            ($forumid,$notneeded,$notneeded,$gforumname) = split(/\t/,$forum);
    	    next if ($forumid !~ /^[0-9]+$/);
                if ($forumid eq "$inforum") {
                    ($forumid, $category, $categoryplace, $forumname, $forumdescription, $forummoderator ,$htmlstate ,$idmbcodestate ,$privateforum, $startnewthreads ,$lastposter ,$lastposttime, $threads, $posts, $forumgraphic, $ratings, $misc,$forumpass,$hiddenforum,$indexforum,$teamlogo,$teamurl, $fgwidth, $fgheight, $miscadd3, $miscadd4, $miscad5) = split(/\t/,$forum);
                }
            $forumname[$forumid]="$gforumname";
         }
		if($category=~/childforum-[0-9]+/){
			$category=~s/^childforum-//;
			$categoryn="编辑 '$forumname[$category]' 中的子论坛 '$forumname' ";
			$modiii = "<BR><font color=blue>子论坛会自动继承父论坛的斑竹,所以注意不要重复输入斑竹</font>";
		}else{
			$categoryn="编辑 '$category' 分类中的 '$forumname' 论坛";
			$modiii = "";
		}

# Present the form to be filled in


        print qq~
        <tr><td bgcolor=#333333" colspan=2><font color=#FFFFFF>
        <b>欢迎来到论坛管理中心 / 编辑论坛</b>
        </td></tr>
        <tr>
        <td bgcolor=#EEEEEE align=center colspan=2>
        <font color=#990000><b>$categoryn</b>
        </td></tr>

        <form action="$thisprog" method="post" enctype="multipart/form-data" name=FORM>

⌨️ 快捷键说明

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