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

📄 post.cgi

📁 绿叶网络小学校园网-完全适合小学的网站
💻 CGI
📖 第 1 页 / 共 4 页
字号:
#!/usr/bin/perl

#############################################################
# Ikonboard v2.1
# Copyright 2000 Ikondiscussion.com - All Rights Reserved
# Ikondiscussion is a trademark of Ikondiscussion.com
#
# Software Distributed by: Ikondiscussion.com
# Visit us online at http://www.ikondiscussion.com
# Email us on boards@ikondiscussion.com
#
# All files written by Matthew Mecham
#############################################################

#use CGI::Carp "fatalsToBrowser";          # Output errors to browser
use CGI qw(:standard);                    # Saves loads of work
$CGI::POST_MAX=1024 * 150;                # limit post data
$CGI::DISABLE_UPLOADS = 1;                # Disable uploads

eval {
($0 =~ m,(.*)/[^/]+,)   and unshift (@INC, "$1");
($0 =~ m,(.*)\\[^\\]+,) and unshift (@INC, "$1");
require "data/progs.cgi";    # Require prog names
require "data/boardinfo.cgi";# Require board info
require "data/styles.cgi";   # Require styles info
require "ikon.lib";          # Require ikonboard ()
require "ikonmail.lib";      # Require email func ()
};
if ($@) {
    print header(-charset=>"gb2312"); print start_html(-title=>"ib2000 出错!");
    print "不能够找到文件:$@\n如果您使用的是 Windows 类操作系统,请在每一个程序中更改 require 的设置,填入绝对路径!";
    print end_html; exit;
}

$|++;                        # Unbuffer the output

#################--- Begin the program ---###################

$thisprog = "post.cgi";

$query = new CGI;

&checkVALIDITY;

$boardurltemp =$boardurl;

$boardurltemp =~ s/http\:\/\/(\S+?)\/(.*)/\/$2/;
$cookiepath = $boardurltemp;
$cookiepath =~ s/$thisprog//sg;

for ('forum','topic','membername','password','action','postno','inshowsignature',
     'notify','inshowemoticons','previewfirst','intopictitle','intopicdescription',
     'inpost','posticon') {
    next unless defined $_;
    next if $_ eq 'SEND_MAIL';
    $tp = $query->param($_);
    $tp = &cleaninput("$tp");
    ${$_} = $tp;
    }



$inforum       = $forum;
$intopic       = $topic;
$inmembername  = $membername;
$inpassword    = $password;
$inpostno      = $postno;
$innotify      = $notify;
$currenttime   = time;
$postipaddress = $ENV{'REMOTE_ADDR'};
$inposticon    = $posticon;


if ($inshowemoticons ne "yes") { $inshowemoticons eq "no"; }
if ($innotify ne "yes")        { $innotify eq "no"; }

    if (! $inmembername) { $inmembername = cookie("amembernamecookie"); }
    if (! $inpassword)   { $inpassword   = cookie("apasswordcookie"); }

    if ($inmembername eq "") {
        $inmembername = "客人";
        }
        else {
            &getmemberstime("$inmembername");
            }

    if ($action eq "addnew" or $action eq "addreply") {

    $namecookie = cookie(-name    =>   "amembernamecookie",
                         -value   =>   "$inmembername",
                         -path    =>   "$cookiepath",
                         -expires =>   "+30d");
    $passcookie = cookie(-name    =>   "apasswordcookie",
                         -value   =>   "$inpassword",
                         -path    =>   "$cookiepath",
                         -expires =>   "+30d");
    print header(-cookie=>[$namecookie, $passcookie], -charset=>"gb2312");
    }
    else {
        print header(-charset=>"gb2312");
        }

    if (($inforum)  && ($inforum !~ /^[0-9]+$/))  { &error("普通&请不要修改生成的 URL!"); }
    if (($intopic ) && ($intopic  !~ /^[0-9]+$/)) { &error("普通&请不要修改生成的 URL!"); }
    if (($inpostno) && ($inpostno !~ /^[0-9]+$/)) { &error("普通&请不要修改生成的 URL!"); }


    $helpurl = &helpfiles("阅读标记");
    $helpurl = qq~$helpurl<img src="$imagesurl/images/help_b.gif" border=0></a>~;

    my %Mode = ( 
    'new'                 =>    \&newthread,
    'reply'               =>    \&reply,        
    'replyquote'          =>    \&replyquote,
    'copy1'     	  =>    \&copy1
    );

	if ($arrawpostpic eq "on") { $postpicstates = "允许";} else {$postpicstates = "禁止";}
	if ($arrawpostfontsize eq "on") { $postfontsizestates = "允许";} else {$postfontsizestates = "禁止";}
	if ($arrawpostsound eq "on") { $postsoundstates = "允许";} else {$postsoundstates = "禁止";}


    if($Mode{$action}) { 
        $Mode{$action}->();
        }
        elsif ($action eq "addnew"   && $previewfirst eq "no")  { &addnewthread; }
        elsif ($action eq "addnew"   && $previewfirst eq "yes") { &newthread; }
        elsif ($action eq "addreply" && $previewfirst eq "no")  { &addreply; }
        elsif ($action eq "addreply" && $previewfirst eq "yes") { &reply; }
        else { &error("普通&请以正确的方式访问本程序!"); }


    &output(
    -Title   => "$boardname - 在$forumname内发贴", 
    -ToPrint => $output, 
    -Version => $versionnumber 
    );



############ New Thread side

sub newthread {

    

    ### 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("发表&对不起,您没有在此论坛中发表的权利!");
        }   

    # Emoticons routine

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


        
    # Add member to who's online    
        
    &whosonline("$inmembername|<a href=\"$forumsprog?forum=$inforum\"><b>$forumname</b></a>|none|发表新主题|") if ($privateforum ne "yes");
    &whosonline("$inmembername|<a href=\"$forumsprog?forum=$inforum\"><b>$forumname</b></a>(密)|none|发表新的保密主题|") if ($privateforum eq "yes");



    # Set up are we previewing/emailing/start thread allowance

    if ($previewfirst eq "yes") {
        &preview;
        $inpost =~ s/\<p\>/\n\n/g;
        $inpost =~ s/\<br\>/\n/g;
        }
        else {
            &mischeader("发表新主题");
            }
        
    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 ($startnewthreads eq "no") {
        $startthreads = "<b>在此论坛中新的主题只能由管理员、版主发表!</b>";
        }   
        else {
            $startthreads = "所有注册会员均可以发表!";
            }


    # 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 = "不可用"; }

#                <td bgcolor=$miscbackone valign=middle><font face="$font" color=$fontcolormisc><b>主题描述</b>(可选)</font></td>
#                <td bgcolor=$miscbackone valign=middle><input type=text size=40 maxlength=60 name="intopicdescription" value="$intopicdescription"></td>
#                </tr><tr>
    $output .= qq~
                <form action="$thisprog" method=post name="FORM">
                <input type=hidden name="action" value="addnew">
                <input type=hidden name="forum" value="$inforum">
        <table cellpadding=0 cellspacing=0 border=0 width=$tablewidth bgcolor=$tablebordercolor align=center>
            <tr><td>
                <table cellpadding=3 cellspacing=1 border=0 width=100%>
                <tr>
                    <td bgcolor=$titlecolor colspan=2><font face="$font" color=$titlefontcolor><b>谁可以发表新主题?</b> $startthreads</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 size=50 maxlength=50 name="intopictitle" value="$intopictitle">&nbsp;&nbsp;不得超过 25 个汉字</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"> &nbsp; <font face="$font" color=$fontcolormisc><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"> &nbsp; <font face="$font" color=$fontcolormisc><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) {
       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

$output .= qq~
</td>
</tr>
                <td bgcolor=$miscbackone valign=top><font face="$font" color=$fontcolormisc><b>内容</b><p>
                在此论坛中:<li>HTML 标签: <b>$htmlstates</b><li><a href="javascript:openScript('misc.cgi?action=ikoncode',300,350)">ib2000 标签</a>: <b>$idmbcodestates</b><li>贴图标签: <b>$postpicstates</b><li>音乐标签: <b>$postsoundstates</b><li>文字大小: <b>$postfontsizestates</b><li>$emoticonslink</font></td>
<td bgcolor=$miscbackone valign=middle>
	$insidejs
          <TEXTAREA cols=80 name=inpost rows=12 wrap="soft">$inpost</TEXTAREA><br>
&nbsp;&nbsp;&nbsp;模式:
<input type="radio" name="mode" value="help" onClick="thelp(1)">&nbsp;&nbsp;帮助&nbsp;&nbsp;
<input type="radio" name="mode" value="prompt" CHECKED onClick="thelp(2)">&nbsp;&nbsp;完全&nbsp;&nbsp;
<input type="radio" name="mode" value="basic"  onClick="thelp(0)">&nbsp;&nbsp;基本&nbsp;&nbsp;
</td></tr>
                </tr>
		<tr>
                <td bgcolor=$miscbackone valign=top colspan=2><font face="$font" color=$fontcolormisc><b>点击表情图即可在贴子中加入相应的表情</B></font><br>&nbsp;
                ~;
    		
    		$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~
                	<a href="javascript:$smileyname();"><img src="$emoticonsurl/$picture" border=0></a>
                	~;
                } #endforeach
    		$output .= qq~
    		</td>
                </tr>
                <tr>
                <td bgcolor=$miscbacktwo valign=top><font face="$font" color=$fontcolormisc><b>选项</b><p>$helpurl</font></td>
                <td bgcolor=$miscbacktwo valign=middle><font face="$font" color=$fontcolormisc><input type=checkbox name="inshowsignature" value="yes" checked>是否显示您的签名?<br>
                $requestnotify
                $emoticonsbutton
                &nbsp;<b>发表之前是否预览? </b><input name="previewfirst" type="radio" value="yes"> 是 &nbsp; <input name="previewfirst" type="radio" value="no" checked> 否</font>
                </font><BR><BR></td>
                </tr><tr>
                <td bgcolor=$miscbacktwo valign=middle colspan=2 align=center>
                <input type=Submit value="发 表" name=Submit"  onClick="return clckcntr();"> &nbsp; <input type="reset" name="Clear" value="清 除">
                </td></form></tr>
            </table>
        </tr></td></table>
        ~;

        

        } # end newthread routine








############### sub addnewthread #############

sub addnewthread { # start routine


    ### Lets sort out the flood control, incase they used the back button...

    &getmember("$inmembername");
        if (($floodcontrol eq "on") && ($membercode ne "ad") && ($membercode ne "mo")) {
            $currenttime = time;
            ($lastpost, $posturl, $posttopic) = split(/\%\%\%/,$lastpostdate);

⌨️ 快捷键说明

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