广播爱好者基地社区天南海北 → 老大,beta 3修改后代码请看
查看完整版本:老大,beta 3修改后代码请看
10/20/2005 10:01:43 PM

retopic.asp

<!-- #include file="setup.asp" -->
<%
top

if Request.Cookies("username")=empty then error("<li>您还未<a href=login.asp>登录</a>社区")

DetectPost

id=int(Request("id"))

sql="Select * From [forum] where ID="&ID&""
rs.Open sql,Conn,1
if rs("locktopic")=1 then error("<li>此主题已经关闭,不接受新的回复")
forumid=rs("forumid")
ReList=rs("ReList")
rs.close

username=Request.Cookies("username")
topic=HTMLEncode(Request("topic"))
content=ContentEncode(Request.Form("content"))

 

if badwords<>empty then
filtrate=split(badwords,"|")
for i = 0 to ubound(filtrate)
topic=ReplaceText(topic,""&filtrate(i)&"",string(len(filtrate(i)),"*"))
content=ReplaceText(content,""&filtrate(i)&"",string(len(filtrate(i)),"*"))
next
end if

If not conn.Execute("Select username From [prison] where username='"&username&"'" ).eof Then error("<li>您被关进<a href=prison.asp>监狱</a>")

'If not conn.Execute("Select username From [forum] where username='"&Request.Cookies("username")&"' and topic='"&topic&"'" ).eof Then error("<li>请不要重复发相同回贴,否则你将被关进监狱")

sql="select * from bbsconfig where id="&forumid&""
Set Rs=Conn.Execute(sql)
bbsname=rs("bbsname")
logo=rs("logo")
followid=rs("followid")

pass=rs("pass")
userlist=rs("userlist")

rs.close

if membercode>1 or instr("|"&moderated&"|","|"&Request.Cookies("username")&"|")>0 then UserPopedomPass=1


if Request.ServerVariables("request_method") = "POST" and Request("preview")="" then

if Len(content)<2 then message=message&"<li>文章内容不能小于 2 字符"

'防止灌水的修正开始'
sql1="select max(posttime) as timepost1  from [forum] where username='"&HTMLEncode(username)&"'"
rs.Open sql1,Conn,1,1
tim1=rs("timepost1")
rs.close

sql2="select max(posttime) as timepost2  from [reforum] where username='"&HTMLEncode(username)&"'"
rs.Open sql2,Conn,1,1
tim2=rs("timepost2")
rs.close

if tim1>tim2 then
tim=tim1
else tim=tim2
end if

no=now( )
if tim<>empty then
distance=datediff("s",tim,no)
if distance<int(PostTime) then message=message&"<li>为防止有人用程序灌水,社区限制一个人两次发帖间隔必须大于"&PostTime&"秒!"
end if

if message<>"" then error(""&message&"")

'防止灌水的修正结束'

sql="select * from [user] where username='"&HTMLEncode(username)&"'"
rs.Open sql,Conn,1,3


if rs("userlife")<3 then
message=message&"<li>您的体力值 < <FONT color=red>3</FONT> 不能发表文章<li>每有效停留时间<FONT color=red> 10 </FONT>分钟:体力值:<FONT color=red>+10</FONT>"
end if

if rs("experience")<1 and Reg10 = 1 then message=message&"<li>新注册用户登录社区停留<FONT color=red> 10 </FONT>分钟以上才可发表帖子"

if message<>"" then error(""&message&"")


if UserPopedomPass<>1 then rs("userlife")=rs("userlife")-1
rs("postrevert")=rs("postrevert")+1
rs("money")=rs("money")+1
rs("experience")=rs("experience")+1
rs("landtime")=now()
rs.update
rs.close


if Request("quote")=1 then
if isnumeric(""&Request("retopicid")&"") then
retopicid=Request("retopicid")
else
retopicid=0
end if
sql="insert into [reforum"&ReList&"] (topicid,username,content,postip,parentID) values ('"&id&"','"&Request.Cookies("username")&"','"&content&"','"&Request.ServerVariables("REMOTE_ADDR")&"','"&retopicid&"')"
conn.Execute(SQL)
else
sql="insert into [reforum"&ReList&"] (topicid,username,content,postip,parentID) values ('"&id&"','"&Request.Cookies("username")&"','"&content&"','"&Request.ServerVariables("REMOTE_ADDR")&"',0)"
conn.Execute(SQL)
end if


conn.execute("update [forum] set lastname='"&username&"',replies=replies+1,lasttime='"&now()&"' where ID="&ID&"")
conn.execute("update [bbsconfig] set lasttopic='<a href=ShowPost.asp?id="&id&">"&left(topic,15)&"</a>',lastname='"&username&"',lasttime='"&now()&"',today=today+1,tolrestore=tolrestore+1 where id="&forumid&"")
conn.execute("update [clubconfig] set today=today+1")

 

Response.Cookies("posttime")=now

Application.Lock
Application(CacheName&"CountReforum") = Application(CacheName&"CountReforum")+1
Application.UnLock


'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'XXX                                      XXX
'XXX         XXXXXXXX      XXX   XX       XXX
'XXX         XXX    XX    XXX XXX         XXX
'XXX        XXX    XX    XXXX             XXX
'XXX       XXX    XX    XXX  XX           XXX
'XXX      XXXXXXXX     XXX     XXX        XXX
'XXX                                      XXX
'XXXXXXXXXXX [最新图片R代码段] XXXXXXXXXXXXXXX
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
piclimit=5           '限制每贴最大只接受的图片
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
content=replace(content,"img]","IMG]")
savepic=0
if instr(content,"[IMG]")>0 then
content_1=split(content,"[IMG]")
for i=1 to ubound(content_1)
content_2=split(content_1(i),"[/IMG]")
picnopass=""
if instr(content_2(0),"images/Emotions/")>0 then picnopass="yes"
if instr(content_2(0),"images/face/")>0 then picnopass="yes"
checksameurl=conn.execute("Select count(*)from [DK_NEWPIC_PLUS] where picurl='"&content_2(0)&"'")(0)
if picnopass=empty and checksameurl=0 then
picurl=content_2(0)
picreadme=topic
username=request.cookies("username")
if savepic<piclimit then
savepic=savepic+1
sql="insert into [DK_NEWPIC_PLUS] (topicid,picurl,username,picreadme) values ('"&id&"','"&picurl&"','"&username&"','"&picreadme&"')":conn.Execute(SQL)
end if
end if
next
end if
content=replace(content,chr(34),"&quot;")
if instr(content,"<IMG src=&quot;")>0 and savepic<piclimit then
content_1=split(content,"<IMG src=&quot;")
for i=1 to ubound(content_1)
content_2=split(content_1(i),"&quot;")
picnopass=""
if instr(content_2(0),"images/Emotions/")>0 then picnopass="yes"
if instr(content_2(0),"images/face/")>0 then picnopass="yes"
checksameurl=conn.execute("Select count(*)from [DK_NEWPIC_PLUS] where picurl='"&content_2(0)&"'")(0)
if picnopass=empty and checksameurl=0 then
picurl=content_2(0):picreadme=topic:username=request.cookies("username")
if savepic<piclimit then
savepic=savepic+1
sql="insert into [DK_NEWPIC_PLUS] (topicid,picurl,username,picreadme) values ('"&id&"','"&picurl&"','"&username&"','"&picreadme&"')":conn.Execute(SQL)
end if
end if
next
end if
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'XXXXXXXXX [最新图片R代码段结束] XXXXXXXXXXXXX
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

message=message&"<li><font color=#ff0000>回复主题成功</font><li><a href=ShowPost.asp?id="&id&">返回主题</a><li><a href=ShowForum.asp?forumid="&forumid&">返回传统模式</a><li><a href=treeForum.asp?forumid="&forumid&">返回树型模式</a><li><a href=Default.asp>返回社区首页</a>"
succeed(""&message&"<meta http-equiv=refresh content=3;url=ShowPost.asp?id="&id&">")

end if
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

 

 


if Request("quote")=1 and Request("preview")="" then

if isnumeric(""&Request("retopicid")&"") then
sql="select * from [reforum"&ReList&"] where id="&Request("retopicid")&""
else
sql="select * from [forum] where ID="&id&""
end if
Set Rs=Conn.Execute(sql)
content =rs("content")

if instr(content,"

")>0 and instr(content,"
")>0 then
delyy=split(content,"")
content=delyy(UBound(delyy))
end if

quote="

引用:原文由 "&rs("username")&" 发表于 "&rs("posttime")&" :<br>"&content&"
"
rs.close

end if


%>

<!-- #include file="inc/validate.asp" -->

<script>
if ("<%=logo%>"!=''){logo.innerHTML="<img border=0 src=<%=logo%> onload='javascript:if(this.height>60)this.height=60;'>"}
</script>

 <table border="0" width="97%" align="center" cellspacing="1" cellpadding="4" class=a2>
  <tr class=a3>
   <td height="25">&nbsp;<img src=images/Forum_nav.gif>&nbsp; <%ClubTree%> → <%ForumTree(followid)%><%=ForumTreeList%> <a href=ShowForum.asp?forumid=<%=forumid%>><%=bbsname%></a> → <a href="ShowPost.asp?id=<%=id%>"><%=topic%></a> → 回复帖子</td> 
  </tr>
 </table><br>

 

<SCRIPT>valigntop()</SCRIPT>
<TABLE cellSpacing=1 cellPadding=5 width=97% border=0 class=a2 align="center">

 

 

<form name="yuziform" method="post" onSubmit="return CheckForm(this);">
<input name="content" type="hidden" value='<%=quote%>'>
<input type="hidden" value="<%=Request("topic")%>" name="topic">

<input type=hidden name=id value=<%=id%>>

<TR>
<TD vAlign=left class=a1 colSpan=2 height=25><b>回复文章</b></TD></TR>
<TR>
<TD width=160 class=a4 height=25><B>用户名称</B></TD>
<TD width=574 class=a4 height=25><%=Request.Cookies("username")%> [<a href="login.asp?menu=out">退出登录</a>]</TD>
</TR>
<TR>
<TD vAlign=top class=a3>
<TABLE cellSpacing=0 cellPadding=0 width=100% align=left border=0>

<TR>
<TD vAlign=top align=left width=100% class=a3><B>文章内容</B><BR>
(<a href="javascript:CheckLength();">查看内容长度</a>)<BR><BR>
</TD></TR>
<TR>
<TD vAlign=center align=center width=100%>
<TABLE
style="BORDER-RIGHT: 1px inset; BORDER-TOP: 1px inset; BORDER-LEFT: 1px inset; BORDER-BOTTOM: 1px inset"
cellSpacing=1 cellPadding=3 border=0>
<TR align=middle>
<script>
ii=0
for(i=1;i<=25;i++) {
index = Math.floor(Math.random() * 80+1);
ii=ii+1
document.write("<TD><a href=javascript:emoticon('"+index+"')><img border=0 src=images/Emotions/"+index+".gif></a></TD>")
if (ii==5){document.write("</TR><TR align=middle>");ii=0;}
}
</script>

</TR></TABLE>
</TD></TR>
</TABLE></TD>
<TD class=a3 height=250>

<SCRIPT src="inc/post.js"></SCRIPT>
</TD></TR>

 

<TR>
<TD align=left class=a4>
<IMG src=images/affix.gif><b>增加附件</b></TD>

<TD align=left class=a4><font color="FFFFFF"><b><IFRAME src="upfile.asp" frameBorder=0 width="100%" scrolling=no height=21></IFRAME></b></font></TD></TR>

<TR>
<TD align=middle class=a3 colSpan=2 height=27>
<INPUT tabIndex=4 type=submit value=回复主题 name=submit1>&nbsp; <input name=preview type="Button" value=" 预 览 " onclick="Gopreview()">   <INPUT type=reset value=" 重 置 "></TD></TR></FORM>
</TABLE>
<SCRIPT>valignbottom()</SCRIPT>
<form name=preview action=preview.asp method=post target=preview_page><input name="content" type="hidden"></form>

<%

htmlend
%>

 

YBB.JS

function ybbcode(temp) {

if (getCookie('ybbcode')!='0'){ //是否打开YBB代码
temp = temp.replace(/&amp;/ig,"&");
temp=temp.replace(/\[(\/|)b\]/ig,"<$1b>");
temp=temp.replace(/\[(\/|)i\]/ig,"<$1i>");
temp=temp.replace(/\[(\/|)u\]/ig,"<$1u>");
temp=temp.replace(/\[(\/|)strike\]/ig,"<$1strike>");
temp=temp.replace(/\[(\/|)center\]/ig,"<$1center>");
temp=temp.replace(/\[(\/|)marquee\]/ig,"<$1marquee>");

temp = temp.replace(/\[QUOTE\]/ig,"<table border='0' width='100%' cellspacing='1' cellpadding='10' bgcolor='#31659C' align='center'><tr><td width='90%' bgcolor='#FFFFFF' style='word-break:break-all'>");
temp = temp.replace(/\[\/QUOTE\]/ig,"</td></tr></table>");

temp=temp.replace(/(\[font=)([^.:;`'"=\]]*)(\])/ig,"<FONT face='$2'>");
temp=temp.replace(/\[\/font\]/ig,"<\/FONT>");
temp=temp.replace(/(\[COLOR=)([^.:;`'"=\]]*)(\])/ig,"<FONT COLOR='$2'>");
temp=temp.replace(/\[\/COLOR\]/ig,"<\/FONT>");
temp=temp.replace(/(\[size=)([0-9]*)(\])/ig,"<FONT size='$2'>");
temp=temp.replace(/\[\/size\]/ig,"<\/FONT>");
temp=temp.replace(/(\[URL\])([^]]*)(\[\/URL\])/ig,"<A TARGET=_blank HREF='$2'>$2</A>");
temp=temp.replace(/(\[URL=)([^]]*)(\])/ig,"<A TARGET=_blank HREF='$2'>");
temp=temp.replace(/\[\/URL\]/ig,"<\/A>");
temp=temp.replace(/(\[EMAIL\])(\S+\@[^]]*)(\[\/EMAIL\])/ig,"<a href=mailto:$2>$2</a>");
temp=temp.replace(/(\[RM=([0-9]*)\,([0-9]*)\,([A-Z]*)\])([^]]*)(\[\/RM\])/ig,"<OBJECT classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA width=$2 height=$3><PARAM NAME=SRC VALUE=$5><PARAM NAME=CONSOLE VALUE=Clip1><PARAM NAME=CONTROLS VALUE=imagewindow><PARAM NAME=AUTOSTART VALUE=$4><\/OBJECT><br><OBJECT classid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA height=60 width=$2><PARAM NAME=CONTROLS VALUE=ControlPanel,StatusBar><PARAM NAME=CONSOLE VALUE=Clip1><\/OBJECT>");
temp=temp.replace(/(\[MP=([0-9]*)\,([0-9]*)\])([^]]*)(\[\/MP\])/ig,"<object classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 width=$2 height=$3><param name=ShowStatusBar value=-1><param name=Filename value=$4><\/object>");
temp=temp.replace(/<A HREF=\"([^"]*)\">/ig,"<A TARGET=_blank HREF=\"$1\">");
temp=temp.replace(/<IMG src=\"([^"]*)\">/ig,"<IMG src=\"$1\" border=0 onmousewheel='return yuzi_img(event,this)' onload='javascript:if(this.width>body.clientHeight)this.width=body.clientHeight' onerror=src='images/banner.gif'>");
}

if (getCookie('ybbflash')!='0'){  //是否打开[FLASH]代码
temp = temp.replace(/(\[FLASH=([0-9]*)\,([0-9]*)\])([^]]*)(\[\/FLASH\])/ig,"<embed width=$2 height=$3 src='$4' wmode=transparent>");
}

if (getCookie('ybbimg')!='0'){  //是否打开[IMG]代码
temp = temp.replace(/(\[IMG\])([^];]*)(\[\/IMG\])/ig,"<a target=_blank href=$2><img border=0 src=\"$2\" onmousewheel='return yuzi_img(event,this)' onload='javascript:if(this.width>800)this.width=800'></a>");
}

if (getCookie('ybbbrow')!='0'){  //是否打开表情代码
temp = temp.replace(/(\[em)([0-9]*)(\])/ig,"<IMG border=0 SRC=images/Emotions/$2.gif>");
}

return (temp);
}


function level(experience,membercode,username,moderated)
{
if (membercode=='0'){levelname="尚未激活";levelimage="<img src=images/level/1.gif>";}
else
if (membercode=='2'){levelname="贵宾会员";levelimage="<img src=images/level/18.gif>";}
else
if (membercode=='4'){levelname="管 理 员";levelimage="<img src=images/level/19.gif>";}
else
if (membercode=='5'){levelname="社区区长";levelimage="<img src=images/level/20.gif>";}
else
if(moderated.indexOf("|"+username+"|") != -1 && moderated!=""){levelname="论坛版主";levelimage="<img src=images/level/18.gif>";}
else
if (experience<= 100){levelname="小野人";levelimage="<img src=images/level/1.gif>";}
else
if (experience<= 250){levelname="野人";levelimage="<img src=images/level/2.gif>";}
else
if (experience<= 550){levelname="土人";levelimage="<img src=images/level/3.gif>";}
else
if (experience<= 1000){levelname="咕噜";levelimage="<img src=images/level/4.gif>";}
else
if (experience<= 2000){levelname="大咕噜";levelimage="<img src=images/level/5.gif>";}
else
if (experience<= 4000){levelname="咕噜队长";levelimage="<img src=images/level/6.gif>";}
else
if (experience<= 8000){levelname="初级守卫";levelimage="<img src=images/level/7.gif>";}
else
if (experience<= 15000){levelname="守卫者";levelimage="<img src=images/level/8.gif>";}
else
if (experience<= 30000){levelname="守卫队长";levelimage="<img src=images/level/9.gif>";}
else
if (experience<= 40000){levelname="斗士";levelimage="<img src=images/level/10.gif>";}
else
if (experience<= 50000){levelname="大斗士";levelimage="<img src=images/level/11.gif>";}
else
if (experience<= 70000){levelname="斗士长";levelimage="<img src=images/level/12.gif>";}
else
if (experience<= 100000){levelname="骑士";levelimage="<img src=images/level/13.gif>";}
else
if (experience<= 130000){levelname="青铜骑士";levelimage="<img src=images/level/14.gif>";}
else
if (experience<= 160000){levelname="白银骑士";levelimage="<img src=images/level/15.gif>";}
else
if (experience<= 2000000){levelname="黄金骑士";levelimage="<img src=images/level/16.gif>";}
else
if (experience> 2000000){levelname="圣骑士";levelimage="<img src=images/level/17.gif>";}
return('');
}

//放大缩小图片
function yuzi_img(e, o)
{
var zoom = parseInt(o.style.zoom, 10) || 100;
zoom += event.wheelDelta / 12;
if (zoom > 0) o.style.zoom = zoom + '%';
return false;
}


function onlineQQlevel(adai)
{
if (adai<= 50){qqlevelname="1级";qqlevelimage="<img src=images/qqlevel/time_star.gif>";}
else
if (adai<= 150){qqlevelname="2级";qqlevelimage="<img src=images/qqlevel/time_star.gif><img src=images/qqlevel/time_star.gif>";}
else
if (adai<= 500){qqlevelname="3级";qqlevelimage="<img src=images/qqlevel/time_star.gif><img src=images/qqlevel/time_star.gif><img src=images/qqlevel/time_star.gif>";}
else
if (adai<= 700){qqlevelname="4级";qqlevelimage="<img src=images/qqlevel/time_star.gif><img src=images/qqlevel/time_star.gif><img src=images/qqlevel/time_star.gif><img src=images/qqlevel/time_star.gif>";}
else
if (adai<= 900){qqlevelname="5级";qqlevelimage="<img src=images/qqlevel/time_star.gif><img src=images/qqlevel/time_star.gif><img src=images/qqlevel/time_star.gif><img src=images/qqlevel/time_star.gif><img src=images/qqlevel/time_star.gif>";}
else
if (adai<= 1000){qqlevelname="6级";qqlevelimage="<img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_star.gif>";}
else
if (adai<= 1200){qqlevelname="7级";qqlevelimage="<img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_star.gif><img src=images/qqlevel/time_star.gif>";}
else
if (adai<= 1400){qqlevelname="8级";qqlevelimage="<img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_star.gif><img src=images/qqlevel/time_star.gif><img src=images/qqlevel/time_star.gif>";}
else
if (adai<= 1600){qqlevelname="12级";qqlevelimage="<img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif>";}
else
if (adai<= 3200){qqlevelname="16级";qqlevelimage="<img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif>";}
else
if (adai<= 5000){qqlevelname="32级";qqlevelimage="<img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif>";}
else
if (adai<= 6000){qqlevelname="48级";qqlevelimage="<img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif>";}
else
if (adai<= 7000){qqlevelname="54级";qqlevelimage="<img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_yueliang.gif>";}
else
if (adai<= 8000){qqlevelname="70级";qqlevelimage="<img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif>";}
else
if (adai<= 9000){qqlevelname="86级";qqlevelimage="<img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif>";}
else
if (adai<= 10000){qqlevelname="102级";qqlevelimage="<img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif><img src=images/qqlevel/time_yueliang.gif>";}
else
if (adai> 12000){qqlevelname="118级";qqlevelimage="<img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_sun.gif>";}
else
if (adai> 150000){qqlevelname="130级";qqlevelimage="<img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_yueliang.gif>";}
else
if (adai> 20000){qqlevelname="150级";qqlevelimage="<img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_sun.gif>";}
else
if (adai> 40000){qqlevelname="300级";qqlevelimage="<img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_sun.gif>";}
else
if (adai> 80000){qqlevelname="500级";qqlevelimage="<img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_sun.gif><img src=images/qqlevel/time_sun.gif>";}
return('');
}

Powered by BBSdiy V2.0 ACCESS © 1998-2024
Processed in 0.06 second(s)