www.pudn.com > bbs3000afree.zip > newtopic.cgi


#!/usr/bin/perl 
#------------------------------------------------------# 
#         本程序为Yuzi工作室提供        # 
#        Yuzi论坛3000(BBS3000)v4.00      # 
#------------------------------------------------------# 
$cgipa=".";  # CGI程序文件的绝对路径 
###################### 
## 以下部分不需修改 ## 
###################### 
require "$cgipa/setup.cgi"; 
&GetCookies; 
######### 
if($ENV{'QUERY_STRING'}) { 
@pairs = split(/&/,$ENV{'QUERY_STRING'}); 
foreach $pair (@pairs) { 
($name, $value) = split(/=/,$pair); 
$value =~ tr/+/ /; 
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; 
$value =~ s///g; 
$value =~ s/\t/--/g; 
$value =~ s/>/>/g; 
$value =~ s/ 0) {  
($dump,$dump,$value) = split(/\r\n/,$value,3); 
}else { 
($dump,$value) = split(/\r\n/,$value,2); 
next if $value =~ /^\s*$/; 
$FORM{$name} = $value; 
chop($FORM{$name}); 
chop($FORM{$name}); 
next; 
} 
$FORM{$name} = $value; 
} 
} 
################## 
$menu= $FORM{'menu'}; 
$id=$FORM{'id'}; 
$username=$FORM{'username'}; 
$userpsd=$FORM{'userpsd'}; 
$titles=$FORM{'titles'}; 
$emote=$FORM{'emote'}; 
$comment=$FORM{'comment'}; 
$titles=~s/>/>/g; 
$titles=~s//g; 
$titles=~s///g; 
$comment=~s///g; 
$comment=~s/\t/    /g; 
$comment=~s/>/>/g; 
$comment=~s//g; 
if ($menu eq "upfile"){&upfile;exit;} 
if($ybbcodeAllow ne "on"){$ybbestate="不";} 
if($Cookies{xuansave}){$savechecked=checked;} 
$maxkk=$maxfj/1024; 
&css; 
print <function HighlightAll(theField) { 
var tempval=eval("document."+theField) 
tempval.focus() 
tempval.select() 
therange=tempval.createTextRange() 
therange.execCommand("Copy")} 
function DoTitle(addTitle) {  
var currentTitle = document.form.titles.value;  
revisedTitle = currentTitle+addTitle;  
document.form.titles.value=revisedTitle;  
return; } 
var MessageMax="$restrictbyte"; 
var Override=""; 
function CheckLength(){ 
MessageLength=document.form.comment.value.length; 
message=""; 
if(MessageMax !=0) { 
message="最大字符为 "+MessageMax+ " 字节"; 
}else{ 
messag =""; 
} 
alert(message+"\\n您的内容已有 "+MessageLength+" 字节"); 
} 
function ValidateForm(){ 
usernameLength=document.form.username.value.length; 
if(usernameLength<1){alert("请输入用户名称!");return false;} 
userpsdLength=document.form.userpsd.value.length; 
if(userpsdLength<1){alert("请输入用户密码!");return false;} 
titlesLength=document.form.titles.value.length; 
if(titlesLength<2){alert("文章标题不能小于2个字符!");return false;} 
MessageLength =document.form.comment.value.length; 
errors=""; 
if(MessageLength<2){ 
errors="文章内容不能小于2个字符!"; 
} 
if(MessageMax !=0){ 
if(MessageLength > MessageMax){ 
errors="本论坛限制文章长度不得超过 "+MessageMax+" 字节\\n目前您的文章字节: "+MessageLength; 
} 
} 
if(errors != "" && Override == ""){ 
alert(errors); 
return false; 
}else{ 
document.form.submit1.disabled = true; 
return true; 
} 
} 
function emoticon(theSmilie){ 
document.form.comment.value += theSmilie + ' '; 
document.form.comment.focus(); 
} 
var i=0; 
function presskey(eventobject){if(event.ctrlKey && window.event.keyCode==13){i++;if (i>1) {alert('帖子正在发出,请耐心等待!');return false;}this.document.form.submit();}} 
 
 
您当前的位置:$FORM{'bbsname'} >> 发表文章$outurl
EOF if($ybbcodeAllow eq "on"){ print < EOF } print <
发表文章
用户名称
  没有注册?
您的密码
  忘记密码?
文章标题
您的表情

文章内容
(查看内容长度)

笑脸开口笑脸微笑说 O
微笑时伸出舌头眨眼微笑苦笑
狡猾的微笑严肃的微笑可爱的笑

YBB代码: $ybbestate允许
贴图标签: $ybbestate允许
表情字符转换: 允许
 

HTML代码 增加附件($maxkk K 以内)
选项
密码保存在缓存里
禁止 YBB代码
禁止 表情字符
不允许别人回复我的文章
 
EOF exit; sub upfile { &origin; if(length($username) > 20){&errorview("您的名字不能大于20个字符!");} open (FILE, "$filepath/data/prison"); @ips = ; close(FILE); foreach $prison(@ips) { ($prison)=split(/\t/,$prison); if ($prison eq $username) {&errorview("您被抓进监狱,无法发表文章!");}} if($id eq "" || $id eq "."){&monitor;} $yhzlurl ="$filepath/yhzl/$username.cgi"; if($regok eq "0"){unless(-f $yhzlurl){ open(PSD,">$yhzlurl"); print PSD $userpsd."\t".$username."\t\t\t".$lasttime; close(PSD); chmod(0666,$yhzlurl);}} open(PSD,"$yhzlurl")||&errorview("对不起,此用户名还没有注册!"); $liness=; close(PSD); ($rdpassword,$rdname,$rdmail,$rdhome,$rlast,$rdqm,$rdsex,$rdwork,$rdcity,$rdlove,$rfy,$rhf,$tu,$jiao,$iewin,$QQ,$photo,$savecookie)=split(/\t/,$liness); if($rdpassword ne $userpsd){&errorview("对不起,您的密码错误!");} $upfile = $FORM{'file_name'}; $filelen=length($upfile); if($filelen > 0){ @a=split(/\"/,$real_file); @b=split(/\\/,$a[3]); $t=@b; $org_name=($b[$t-1]); $org_name=~ tr/ /_/; ($filenameleft,$filenameright)= split(/\./,$org_name); if ($filelen > $maxfj){&errorview("上传附件超长!您上传的附件长度是 $filelen byte, 本站接受的附件最大长度是 $maxfj byte!");exit;} $filenameright=~tr/A-Z/a-z/; unless(-e "$ImgDir/genre/$filenameright.gif"){&errorview("本系统不支持这种格式的文件!");} $filename = "$ImgDir/affix/$ftime.$filenameright"; open(FILE,">$filename")||&errorview("系统无法建立文件,请检查 $ImgDir/affix 目录属性是否为“777”"); binmode FILE; print FILE $upfile; close FILE; chmod("$filename",0777); $sizek=$filelen/1024; ($sizek)=split(/\./,$sizek); if($sizek eq "0"){$sizek=1}; $comment.="
与此主题相关的附件(大小:$sizek K)"; if($filenameright eq "gif" || $filenameright eq "bmp" || $filenameright eq "jpeg" || $filenameright eq "jpg"){$comment.="
";} elsif($filenameright eq "mid" || $filenameright eq "wav"){$comment.="
";} } foreach (@badwords) {$comment =~s/$_/****/gi;} if($FORM{'smilies'} ne "1"){$comment = &smilies("$comment");} if($ybbcodeAllow eq "on" && $FORM{'ybbcode'} ne "1"){$comment = &ybbcode("$comment");} foreach (@badwords) {$titles =~s/$_/****/gi;} if(($username eq "")||($userpsd eq "")){&errorview("您的名字和密码不能没有填写!");} $titles =~s/ / /g; if((length($titles) > 100)||(length($titles) < 2)){&errorview("文章标题不能小于2个字符并且不能大于100个字符!");} if(length($comment) > $restrictbyte){&errorview("文章内容不能大于$restrictbyte个字节!");} ($ip1,$ip2,$ip3,$ip4)=split(/\./,$from);$badi="$ip1.$ip2.$ip3"; foreach $badip (@badip) {&errorview("对不起!此段IP被禁止发表文章!") if($badip eq $badi);exit if($badip eq $badi);} if($Cookies{lasttxt} > $ftime-30){&errorview("为防止有人用程序灌水,本BBS限制一个人两次发帖间隔必须大于30秒!");} print "Set-Cookie:lasttxt=$ftime\n"; &repeat; open(NUMBER,"$filepath/guest/2$username.cgi"); $NUMBER=; close(NUMBER); ($lys,$oldlys,$money,$charm)=split(/\t/,$NUMBER); if($charm < 0){&errorview("您的魅力太低,不能发表文章!请联系社区区长。");} $money=$money+10;$charm=$charm+0.5; open(NUMBER,">$filepath/guest/2$username.cgi"); print NUMBER "$lys"."\t"."$oldlys"."\t"."$money"."\t"."$charm"; close(NUMBER); open(TITLES,"$filepath/list/$id/bbs"); @hastitles=; close(TITLES); open(TITLES,">$filepath/list/$id/bbs"); print TITLES "$ftime\n"; print TITLES @hastitles; close(TITLES); if($emote eq ""){$emote="1"}; $peo="$filepath/list/$id/$ftime"; open(TMP,">$peo")||&errorview("系统无法建立文件,请检查 $filepath/list/$id 目录属性是否为“777”"); print TMP $titles."\t".$thistime."\t".$username."\t".$comment."\t".$from."\t0\t".$emote."\t--\t".$thistime."\t"."$ftime"."b"."\t0\t\t".$FORM{'no'}; close(TMP); chmod(0666,$peo); open(PSD,"$filepath/yhzl/$username.cgi"); $line=; close(PSD); ($rdpassword,$rusername,$rdmail,$rdhome,$rlast,$rdqm,$rdsex,$rdwork,$rdcity,$rdlove,$rfy,$rhf,$tu,$jiao,$iewin,$QQ,$photo,$rating,$levelname,$level,$lastlytime,$lastlytopic,$realname,$birthday,$shengxiao,$blood,$constellation,$character,$belief,$marital,$education,$college,$oldrat)=split(/\t/,$line); if($oldrat){$rating=$oldrat;} if($rating eq "on"){$rating=0;} if($tu eq ""){$tu=$sec};$rfy++; $rusername=$username; do "$cgipa/sub/level.cgi"; ($kkk)=split(/\)/,$ENV{'HTTP_USER_AGENT'}); ($bzd,$ie,$win,$me)=split(/;/,$kkk); if($me eq " Win 9x 4.90"){$win=" Windows Me"} elsif($win eq " Windows NT 5.0"){$win=" Windows 2000"} elsif($win eq " Windows NT 5.1"){$win=" Windows XP"}; open(PSD,">$filepath/yhzl/$username.cgi"); print PSD $rdpassword."\t".$username."\t".$rdmail."\t".$rdhome."\t".$rlast."\t".$rdqm."\t".$rdsex."\t".$rdwork."\t".$rdcity."\t".$rdlove."\t".$rfy."\t".$rhf."\t".$tu."\t".$jiao."\t$ie$win\t".$QQ."\t".$photo."\t".$rating."\t".$levelname."\t".$level."\t".$thistime."\t"."$titles\t".$realname."\t".$birthday."\t".$shengxiao."\t".$blood."\t".$constellation."\t".$character."\t".$belief."\t".$marital."\t".$education."\t".$college; close(PSD); open(TITLES,"$filepath/postlog/$username.cgi"); @hastitles=; close(TITLES); open(TITLES,">$filepath/postlog/$username.cgi")||&errorview("系统无法建立文件,请检查 $filepath/postlog 目录属性是否为“777”"); print TITLES "$ftime\t$id\t$FORM{'bbsname'}\n"; print TITLES @hastitles[0..18]; close(TITLES); open(NUMBER,"$filepath/data/count"); $NUMBER=; close(NUMBER); ($riqi,$fa,$hui)=split(/\t/,$NUMBER); if ($riqi eq "$year$mon$mday"){$fa++;}else{$riqi="$year$mon$mday";$fa="1";$hui="0";} open(NUMBER,">$filepath/data/count"); print NUMBER "$riqi"."\t"."$fa"."\t"."$hui"; close(NUMBER); print "Set-Cookie:del=$ftime\n"; print "Content-type: text/html\n\n"; print <
谢谢$username,您的信息已成功发出!

请等待系统将自动返回...

(如果您不愿意等待,请点击这里返回)
EOF if($userpsd ne ""){&cookie;} exit; } ######################### END OF SCRIPT #########################