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

📄 setforums.cgi

📁 绿叶网络小学校园网-完全适合小学的网站
💻 CGI
📖 第 1 页 / 共 4 页
字号:
                    if ($forumid > $high) { $high = $forumid; }
                    }
                    
                $high++;
                
                $newforumid = $high;    

               
                # Lets create the directory.
                
                $dirtomake = "$ikondir" . "forum$newforumid";

                mkdir ("$dirtomake", 0755);
                
                # 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 = "$dirtomake/.htaccess";
                open(FILE, ">$filetomake");
                flock (FILE, 2) if ($OS_USED eq "Unix");
                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);

                $filetoopen = "$ikondir" . "data/allforums.cgi";
                open(FILE, "$filetoopen");
                @forums = <FILE>;
                close(FILE);
   
                
                open(FILE, ">$filetoopen");
                flock(FILE, 2) if ($OS_USED eq "Unix");
                foreach $line (@forums) {
                    chomp $line;
                    print FILE "$line\n";
                    }
                print FILE "$newforumid|$new_categoryname|$incategory|$new_forumname|$new_forumdescription|$new_forummoderator|$new_htmlstate|$new_idmbcodestate|$new_privateforum|$new_startnewthreads|||0|0|$new_forumgraphic";
                close(FILE);
                
                print qq~
                <tr><td bgcolor=#333333" colspan=2><font face=宋体 color=#FFFFFF>
                <b>欢迎来到论坛管理中心 / 增加分类(同时增加一个论坛)结果</b>
                </td></tr>
                <tr>
                <td bgcolor=#FFFFFF valign=middle align=left colspan=2>
                <font face=宋体 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 !<p>\n";
                        }
                print "$filetoopen<p>\n";
                print "</ul></td></tr></table></td></tr></table>\n";

} # end routine
        

##################################################################################
######## Subroutes ( Edit Category Name )


sub editcatname {

        
        if ($checkaction ne "yes") {
        
            # Grab the line to edit.
        
            $filetoopen = "$ikondir" . "data/allforums.cgi";
            open(FILE,"$filetoopen") or &systemerror("不能找到文件 $filetoopen");
            flock(FILE,2) if ($OS_USED eq "Unix");
            @forums = <FILE>;
            close(FILE);

            foreach $forum (@forums) {
            chomp $forum;
                ($notneeded, $notneeded, $categoryplace) = split(/\|/,$forum);
                    if ($incategory eq "$categoryplace") {
                        ($trash, $categoryname, $notneeded) = split(/\|/,$forum);   
                        }
                    }
        
            # Present the form to be filled in


            print qq~
            <form action="$thisprog" method="post">
            <input type=hidden name="action" value="editcatname">
            <input type=hidden name="category" value="$incategory">
            <input type=hidden name="checkaction" value="yes">
            <tr><td bgcolor=#333333" colspan=2><font face=宋体 color=#FFFFFF>
            <b>欢迎来到论坛管理中心 / 编辑分类名称</b>
            </td></tr>
            <tr>
        
            <tr>
            <td bgcolor=#EEEEEE valign=middle align=center colspan=2>
            <font face=宋体 color=#990000><b>编辑 '$categoryname' 分类的名称</b>
            </td></tr>
                
                
            <tr>
            <td bgcolor=#FFFFFF valign=middle align=left width=40%>
            <font face=宋体 color=#333333><b>分类名称</b><br>请输入分类名称</font></td>
            <td bgcolor=#FFFFFF valign=middle align=left>
            <input type=text size=40 name="categoryname" value="$categoryname"></td>
            </tr>
            
            
            <tr>
            <td bgcolor=#FFFFFF valign=middle align=center colspan=2>
            <input type=submit value="提 交"></form></td></tr></table></td></tr></table>
            ~;
            } # end if
            
            else {
            
                # Grab the lines to change.
        
                $filetoopen = "$ikondir" . "data/allforums.cgi";
                open(FILE,"$filetoopen") or &systemerror("不能找到文件 $filetoopen");
                flock(FILE,2) if ($OS_USED eq "Unix");
                @forums = <FILE>;
                close(FILE);

                # Lets remake the file with the new info
                
                $filetoopen = "$ikondir" . "data/allforums.cgi";
                open(FILE,">$filetoopen") or &systemerror("不能找到文件 $filetoopen");
                flock(FILE,2) if ($OS_USED eq "Unix");
                foreach $forum (@forums) {
                chomp $forum;
                ($notneeded, $notneeded, $categorynumber) = split(/\|/,$forum);
                    if ($incategory eq "$categorynumber") {
                        ($forumid, $category, $categoryplace, $forumname, $forumdescription, $forummoderator ,$htmlstate ,$idmbcodestate ,$privateforum, $startnewthreads ,$lastposter ,$lastposttime, $threads, $posts, $forumgraphic) = split(/\|/,$forum);
                        $linetochange = "$forumid|$new_categoryname|$incategory|$forumname|$forumdescription|$forummoderator|$htmlstate|$idmbcodestate|$privateforum|$startnewthreads|$lastposter|$lastposttime|$threads|$posts|$forumgraphic"; 
                        chomp $linetochange;
                        print FILE "$linetochange\n";
                        $forumname = ""; $forumdescription = ""; $forummoderator = ""; $lastposter = ""; $lastposttime = ""; $threads = ""; $posts = ""; $forumgraphic = "";
                        }
                        else {
                            print FILE "$forum\n";
                            }
                    }
                close (FILE);
                
                
                print qq~
                <tr><td bgcolor=#333333" colspan=2><font face=宋体 color=#FFFFFF>
                <b>欢迎来到论坛管理中心 / 编辑分类名称结果</b>
                </td></tr>
                <tr>
                <td bgcolor=#EEEEEE valign=middle align=center colspan=2>
                <font face=宋体 color=#333333><b>所有信息已经成功保存</b>
                </td></tr></table></td></tr></table>
                ~;
                
                } # end else
                
            } # end routine


##################################################################################
######## Subroutes ( Edit Category Name )


sub reordercats {

        
        if ($checkaction ne "yes") {

            print qq~
            <form action="$thisprog" method="post">
            <input type=hidden name="action" value="reordercategories">
            <input type=hidden name="checkaction" value="yes">
            <tr><td bgcolor=#333333" colspan=2><font face=宋体 color=#FFFFFF>
            <b>欢迎来到论坛管理中心 / 论坛分类重新排序</b>
            </td></tr>
            <tr><td bgcolor=#FFFFFF" colspan=3><font face=宋体 color=#333333>
            <b>注意事项:</b><br><br>
            在此您可以将论坛分类重新排序。分类将按照数字重新显示。<BR><BR><b>1 表示此为第一分类,将显示在最前面</b>。<br><br>
            <b>提交之前请仔细检查所有设置,并保证没有重复数字,有重复将会导致有的分类无法显示!</b><br><br>
            </td></tr>
            ~;
            
            $filetoopen = "$ikondir" . "data/allforums.cgi";
            open(FILE, "$filetoopen") or &systemerror("Cannot locate $filetoopen");
            @forums = <FILE>;
            close(FILE);

            foreach $forum (@forums) { #start foreach @forums
                chomp $forum;
                ($forumid, $category, $categoryplace, $forumname, $forumdescription) = split(/\|/,$forum);
                $rearrange = ("$categoryplace|$category|$forumname|$forumdescription|$forumid");
                push (@rearrangedforums, $rearrange);

                } # end foreach (@forums)

            @finalsortedforums = sort(@rearrangedforums);

            foreach $sortedforums (@finalsortedforums) { #start foreach @finalsortedforums

                ($categoryplace, $category) = split(/\|/,$sortedforums);
    
                if ($categoryplace ne $lastcategoryplace) { #start if $categoryplace
                    print qq~
                    <tr>
                    <td bgcolor=#FFFFFF width=40%><font face=宋体 color=#333333>
                    <b>-=> $category</b></font></td>
                    <td bgcolor=#FFFFFF><font face=宋体 color=#333333>现在位置 [ <B>$categoryplace</B> ],请输入新的数字以便排序:<input type=text size=4 maxlength=2 name="$categoryplace" value="$categoryplace">
                    </td></tr>
                    ~;
                    } # end if
                    
                    $lastcategoryplace = $categoryplace;
                    
                 } # end foreach
                    
                    
                    
                    print qq~
                    <tr>
                    <td bgcolor=#EEEEEE valign=middle align=center colspan=2>
                    <BR><input type=submit value="提 交"></td></form></tr></table></td></tr></table>
                    ~;
                    
            } # end if
    
            
            else {
            
                # Grab the lines to change.
        
                $filetoopen = "$ikondir" . "data/allforums.cgi";
                open(FILE,"$filetoopen") or &systemerror("不能找到文件 $filetoopen");
                flock(FILE,2) if ($OS_USED eq "Unix");
                @forums = <FILE>;
                close(FILE);

                # Lets remake the file with the new info
                
                $filetoopen = "$ikondir" . "data/allforums.cgi";
                open(FILE,">$filetoopen") or &systemerror("不能找到文件 $filetoopen");
                flock(FILE,2) if ($OS_USED eq "Unix");
                foreach $forum (@forums) {
                    chomp $forum;
                    ($notneeded, $notneeded, $categorynumber) = split(/\|/,$forum);
                    $newid = $PARAM{$categorynumber};
                    ($forumid, $category, $categoryplace, $forumname, $forumdescription, $forummoderator ,$htmlstate ,$idmbcodestate ,$privateforum, $startnewthreads ,$lastposter ,$lastposttime, $threads, $posts, $forumgraphic) = split(/\|/,$forum);
                    print FILE "$forumid|$category|$newid|$forumname|$forumdescription|$forummoderator|$htmlstate|$idmbcodestate|$privateforum|$startnewthreads|$lastposter|$lastposttime|$threads|$posts|$forumgraphic\n"; 
                    }
            
                close (FILE);
                
                
                print qq~
                <tr><td bgcolor=#333333" colspan=2><font face=宋体 color=#FFFFFF>
                <b>欢迎来到论坛管理中心 / 编辑分类名称结果</b>
                </td></tr>
                <tr>
                <td bgcolor=#EEEEEE valign=middle align=center colspan=2>
                <font face=宋体 color=#333333><b>所有信息已经成功保存</b>
                </td></tr></table></td></tr></table>
                ~;
                
                } # end else
            
            
} # end routine

print qq~</td></tr></table></body></html>~;
exit;

sub errorout {
                print qq~
                <tr><td bgcolor=#333333" colspan=2><font face=宋体 color=#FFFFFF>
                <b>欢迎来到论坛管理中心 / 发生错误</b>
                </td></tr>
                <tr>
                <td bgcolor=#FFFFFF valign=middle align=left colspan=2>
                <font face=宋体 color=#333333>
                <font face=宋体 color=#333333><b>$_[0]</b>
                </td></tr></table></td></tr></table>
                ~;
exit;	
}

⌨️ 快捷键说明

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