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

📄 post.cgi

📁 绿叶网络小学校园网-完全适合小学的网站
💻 CGI
📖 第 1 页 / 共 4 页
字号:
            $lastpost = ($lastpost + $floodcontrollimit);
            if ($lastpost > $currenttime)  {
                &error("发表新主题&灌水预防机制已经使用,您必须等待 $floodcontrollimit 秒钟才能再次发表!");
                }
            }
        
            
    # Sort out the forum moderator

    &moderator;

    if ($startnewthreads eq "no") {
        unless ($membercode eq "ad" || $inmembmod eq "yes") {
            &error("发表新主题&在此论坛中只能由坛主或者版主发表新主题!");
            }
        }
    
    if    ($userregistered eq "no")     { &error("发表新主题&您没有注册!"); }
    elsif ($inpassword ne $password)    { &error("发表新主题&您的密码错误!"); }
    elsif ($membercode eq "banned")     { &error("添加回复&您被禁止发言!"); }
    elsif ($intopictitle eq "")         { &error("发表新主题&必须输入主题标题!"); }
    elsif (length($intopictitle) > 52)         { &error("发表新主题&主题标题过长!"); }
    else  { # start else

        &getforum("$inforum");

        if ($inpost eq "")               { $intopictitle.=" (无内容)"; }

        if (($allowedentry{$inforum} eq "yes")||($membercode eq "ad")) { $allowed = "yes"; }
        
        if (($privateforum eq "yes") && ($allowed ne "yes")) {
            &error("发表&对不起,您不允许在此论坛发表!");
        }   

	&error("发表&老大,有你这么发言的吗!") if (($inpost =~ /\w{80,}/)||($inpost =~ /[(!)(~)(·)(#)(¥)(%)(…)(—)(*)(()())(+)(|)(})({)(])([)(“)(:)(;)(‘)(?)(〉)(《)]{40,}/)||($inpost =~ /[\!\~\`\@\#\$\%\^\&\*\(\)\_\+\|\\\=\-\]\[\{\}\'\;\:\"\/\.\,\<\>\?]{80,}/));
        
        ### Get a new thread number.

        $dirtoopen = "$ikondir" . "forum$inforum";
        opendir (DIR, "$dirtoopen"); 
        @dirdata = readdir(DIR);
        closedir (DIR);

        @sorteddirdata = grep(/thd/,@dirdata);
        @newdirdata = sort numerically(@sorteddirdata);
        @neworderdirdata = reverse(@newdirdata);

        $highest = @neworderdirdata[0];
        $highest =~ s/.thd$//;
        $newthreadnumber = $highest + 1;

        # Write the list.threadnumber entry
        
        $filetoopen = "$ikondir" . "forum$inforum/$newthreadnumber.pl";
        $filetoopen = &stripMETA($filetoopen);
        open(FILE, ">$filetoopen");
        flock (FILE, 2) if ($OS_USED eq "Unix");
        print FILE "$newthreadnumber|$intopictitle|$intopicdescription|open|0|0|$inmembername|$currenttime||$currenttime|";
        close(FILE);

        # Create the new thread file
        
        $filetomake = "$ikondir" . "forum$inforum/$newthreadnumber.thd";
        $filetomake = &stripMETA($filetomake);
        open(FILE, ">$filetomake");
        flock(FILE, 2) if ($OS_USED eq "Unix");
        print FILE "$inmembername|$intopictitle|$postipaddress|$inshowemoticons|$inshowsignature|$currenttime|$inpost|$inposticon|";
        close(FILE);


################## 记录最新的发贴情况
if ($privateforum ne "yes") {
   $filetomakeopen = "$ikondir" . "data/recentpost.cgi";
   if (-e $filetomakeopen) {
      open(FILE, "$ikondir" . "data/recentpost.cgi") || die("Can't open recentpost.cgi");
      @recentposts=<FILE>;
      close(FILE);
      $recentposts=@recentposts;
      if ($recentposts<$maxpostreport) {
          $maxpostreport=$recentposts;
      }
      else {
          $maxpostreport--;
      }
      open (FILE, ">$ikondir" . "data/recentpost.cgi") || die("Can't open recentpost.cgi");
      print FILE "$inforum|$newthreadnumber|$intopictitle|$currenttime|\n";
   
      for ($i=0;$i<$maxpostreport;$i++) {
         print FILE @recentposts[$i];
      }
      close(FILE);
   }
   else {
      open (FILE, ">$ikondir" . "data/recentpost.cgi") || die("Can't open recentpost.cgi");
      print FILE "$inforum|$newthreadnumber|$intopictitle|$currenttime|\n";
      close(FILE);
   }
}
##### end        
        # Update stats for member, and board
        
        &getforum("$inforum");        

        $cleanmembername = $inmembername;
        $cleanmembername =~ s/ /\_/isg;
        $numberofposts++;
        $lastpostdate = "$currenttime\%\%\%$threadprog?forum=$inforum&topic=$newthreadnumber\%\%\%$intopictitle" if ($privateforum ne "yes");
        chomp $lastpostdate;
        
        $filetomake = "$ikondir" . "members/$cleanmembername.cgi";
        $filetomake = &stripMETA($filetomake);
        open(FILE, ">$filetomake");
        flock(FILE, 2) if ($OS_USED eq "Unix");
        print FILE "$inmembername|$password|$membertitle|$membercode|$numberofposts|$emailaddress|$showemail|$ipaddress|$homepage|$aolname|$icqnumber|$location|$interests|$joineddate|$lastpostdate|$signature|$timedifference|$privateforums|$useravatar|$misc1|$misc2|$misc3|$personalavatar|$personalwidth|$personalheight|";
        close(FILE);
        
        $filetoopen = "$ikondir" . "data/allforums.cgi";
        $filetoopen = &stripMETA($filetoopen);
        open(FILE, "$filetoopen");
        @allforums = <FILE>;
        close(FILE);
        
        $filetomake = "$ikondir" . "data/allforums.cgi";
        $filetomake = &stripMETA($filetomake);
        open(FILE, ">$filetomake");
        flock(FILE, 2) if ($OS_USED eq "Unix");
        foreach $forum (@allforums) { #start foreach @forums
        chomp($forum);
            ($tempno, $trash) = split(/\|/,$forum);
                if ($inforum eq $tempno) {
                    ($forumid, $category, $categoryplace, $forumname, $forumdescription, $forummoderator ,$htmlstate ,$idmbcodestate ,$privateforum, $startnewthreads ,$lastposter ,$lastposttime, $threads, $posts, $forumgraphic) = split(/\|/,$forum);
                    $lastposter = $inmembername;
                    $lastposttime = $currenttime;
                    $threads++;
                    print FILE "$forumid|$category|$categoryplace|$forumname|$forumdescription|$forummoderator|$htmlstate|$idmbcodestate|$privateforum|$startnewthreads|$lastposter|$lastposttime|$threads|$posts|$forumgraphic|\n";
                }
            else { print FILE "$forum\n"; }
        }
        close(FILE);

        require "$ikondir" . "data/boardstats.cgi";
        
        $filetomake = "$ikondir" . "data/boardstats.cgi";
        $filetomake = &stripMETA($filetomake);
        
        $totalthreads++;
        
        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);
        
        
        # if the user wants email notifications, lets add them.
        
        if (($emailfunctions eq "on") && ($innotify eq "yes")) { # start mail
        
            $filetomake = "$ikondir" . "forum$inforum/$newthreadnumber.mal";
            
            open (FILE, ">$filetomake");
            flock (FILE, 2) if ($OS_USED eq "Unix");
            print FILE "$inmembername|$emailaddress|\n";
            close (FILE);
        
            } # end if
            
        &mischeader("新主题发表成功");
        
        if ($refreshurl == 1) {
	        $relocurl = "$threadprog?forum=$inforum&topic=$newthreadnumber";
	}
	else {
               	$relocurl = "$forumsprog?forum=$inforum";
        }

        $output .= qq~
            <table cellpadding=0 cellspacing=0 border=0 width=$tablewidth bgcolor=$tablebordercolor align=center>
            <tr>    
            <td>
            <table cellpadding=6 cellspacing=1 border=0 width=100%>
            <tr>
            <td bgcolor=$miscbacktwo valign=middle align=center><font face="$font" color=$fontcolormisc><b>谢谢!您的新主题已经发表成功!</b></font></td></tr>
            <tr>
            <td bgcolor=$miscbackone valign=middle><font face="$font" color=$fontcolormisc>
            如果浏览器没有自动返回,请点击下列链接!
            <ul>
            <li><a href="$threadprog?forum=$inforum&topic=$newthreadnumber">返回新主题</a>
            <li><a href="$forumsprog?forum=$inforum">返回论坛</a>
            <li><a href="$forumsummaryprog">返回论坛首页</a>
            </ul>
            </tr>
            </td>
            </table></td></tr></table>
            <meta http-equiv="refresh" content="3; url=$relocurl">
            ~;
            
     rebuildLIST(-Forum=>"$inforum");

    } # end else

} # end addnewthread







###########################################
############## reply side #################

sub reply {

    


    ### Lets sort out the flood control

    &getmember("$inmembername");
        if (($floodcontrol eq "on") && ($membercode ne "ad") && ($membercode ne "mo")) {
            $currenttime = time;
            ($lastpost, $posturl, $posttopic) = split(/\%\%\%/,$lastpostdate);
            $lastpost = ($lastpost + $floodcontrollimit);
            if ($lastpost > $currenttime)  {
                &error("发表回复&灌水预防机制已经使用,您必须等待 $floodcontrollimit 秒钟才能再次发表!");
                }
            }

    &getforum("$inforum");

        if (($allowedentry{$inforum} eq "yes")||($membercode eq "ad")) { $allowed = "yes"; }
        
        if (($privateforum eq "yes") && ($allowed ne "yes")) {
            &error("发表&对不起,您不允许在此论坛发表!");
        }   

    if ($threadstate eq "locked") { &error("发表回复&对不起,这个主题已经被锁定!"); }



    if ($emoticons eq "on") {
        $emoticonslink = qq~<a href="javascript:openScript('$miscprog?action=showsmilies',300,350)">使用表情字符转换</a>~;
        $emoticonsbutton =qq~<input type=checkbox name="inshowemoticons" value="yes" checked>您是否希望<b>使用</b>表情字符转换在您的文章中?<br>~;
        }


    if ($emailfunctions eq "on") { 
           if ($innotify eq "yes") {
              $requestnotify = qq~<input type=checkbox name="notify" value="yes" checked>有回复时使用邮件通知您?<br>~;
              } 
              else {
                   $requestnotify = qq~<input type=checkbox name="notify" value="yes">有回复时使用邮件通知您?<br>~;
                   }
            }


    if ($previewfirst eq "yes") {
        &preview;
        $inpost =~ s/\<p\>/\n\n/g;
        $inpost =~ s/\<br\>/\n/g;
        }
        else {
            &mischeader("发表回复")
            }

    if ($threadstate eq "closed") { &error("发表回复&坏孩子,你怎么能回复一个已经锁定的贴子呢?呵呵!"); }
    
    # Output the form

	$emoticonsurl = qq~$imagesurl/emot~;
	$dirtoopen = "$imagesdir" . "emot"; 
	opendir (DIR, "$dirtoopen") or die "表情图片所在目录没有找到: $dirtoopen !";
	@dirdata = readdir(DIR); 
	closedir (DIR);
	@emoticondata = grep(/gif$/,@dirdata);

	foreach $picture (@emoticondata) {
	    $smileyname = $picture;
	    $smileyname =~s/\.gif$//g;
  	    $output .= qq~ <script language="javascript">
	    function $smileyname() {
	    document.FORM.inpost.value+=' :$smileyname:'; }
	    </script> ~;
	} #endforeach 
    
    if ($htmlstate eq "on") { $htmlstates = "可用"; } else { $htmlstates = "不可用"; }
    if ($idmbcodestate eq "on") { $idmbcodestates = "可用"; } else { $idmbcodestates = "不可用"; }

    &whosonline("$inmembername|<a href=\"$forumsprog?forum=$inforum\"><b>$forumname</b></a>|none|回复<a href=\"$threadprog?forum=$inforum&topic=$intopic\"><b>$topictitle</b></a>|") if ($privateforum ne "yes");
    &whosonline("$inmembername|<a href=\"$forumsprog?forum=$inforum\"></b>$forumname</b></a>(密)|none|回复保密贴子|") if ($privateforum eq "yes");

        if ($badwords) {
            @pairs = split(/\&/,$badwords);
            foreach (@pairs) {
                ($bad, $good) = split(/=/,$_);
                chop $good;
                $topictitle =~ s/$bad/$good/isg;
                $inpost =~ s/$bad/$good/isg;
                }
            }

    $output .= qq~
	<form action="$thisprog" method=post name="FORM">
        <input type=hidden name="action" value="addreply">
        <input type=hidden name="forum" value="$inforum">
        <input type=hidden name="topic" value="$intopic">
        <table cellpadding=0 cellspacing=0 border=0 width=$tablewidth bgcolor=$tablebordercolor align=center>
        <tr><td>
            <table cellpadding=4 cellspacing=1 border=0 width=100%>
                <tr>
                    <td bgcolor=$titlecolor colspan=2><font face="$font" color=$titlefontcolor><b>主题标题</b>: $topictitle</td>
                </tr>
		<tr>
                    <td bgcolor=$miscbackone valign=middle><font face="$font" color=$fontcolormisc><b>用户名</b></font></td>
                    <td bgcolor=$miscbackone valign=middle><input type=text name="membername" value="$inmembername"><font face="$font" color=$fontcolormisc> &nbsp; <a href="$registerprog">您没有注册?</a></font></td>
                </tr><tr>
                    <td bgcolor=$miscbackone valign=middle><font face="$font" color=$fontcolormisc><b>密码</b></font></td>
                    <td bgcolor=$miscbackone valign=middle><input type=password name="password" value="$inpassword"><font face="$font" color=$fontcolormisc> &nbsp; <a href="$profileprog?action=lostpass">忘记密码?</a></font></td>
                </tr>

<tr>
<td bgcolor=$miscbackone valign=top><font face="$font" color=$fontcolormisc><b>当前心情</b><br><li>将放在贴子的前面<BR><BR>刷新页面可以获得不同的心情图</font></td>
<td bgcolor=$miscbackone valign=top>
~;

####Get the post Icons####
    
    $dirtoopen = "$imagesdir" . "posticons";
    opendir (DIR, "$dirtoopen") or die "表情图片所在目录没有找到: $dirtoopen !"; 
    @dirdata = readdir(DIR);
    closedir (DIR);


    @posticondata = grep(/gif$/,@dirdata);
    
    $tempiconnum=1;
    foreach $picture (@posticondata) {
       $posticonname = $picture;
       $posticonname =~ s/\.gif$//g;
       if ($tempiconnum > 12) {
    	   $tempiconnum = 1;
    	   $output .= qq~<BR>~;
       }
       $on=int(rand(3)+1);
       if ($on==3) {
          $output .= qq~<input type=radio value="$picture" name="posticon"><img src="$imagesurl/posticons/$picture" width=13 height=13 border=0>&nbsp;~;
          $tempiconnum ++;
       }
    } #endforeach
    

⌨️ 快捷键说明

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