bbs_send.asp

来自「安全性好,适用于制作论坛和进行资源下载的个人和大型网站使用!」· ASP 代码 · 共 222 行

ASP
222
字号
<!--#include file="inc/pstart.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="inc/incpage.asp"-->
<!--#include file="inc/bbsinfo.asp"-->
<%
call checkulogin()
call checkhmd()
call noout()
If DateDiff("s",Request.Cookies("Hxcms.bbs")("vtime"),Now())<20 Then 
       URL=Request.ServerVariables("Http_REFERER") 
       Response.Write("<meta http-equiv=""refresh"" content=""2;URL="&URL&""">") 
       Response.Write("对不起,本系统启用了防刷新机制(发贴时间间隔为20秒),2秒后返回...") 
       Response.End
    End IF 
Response.Cookies("Hxcms.bbs")("vtime")=Now()
if request.querystring("type")="save" then
voteyn=checknum(request.form("voteyn"))
canvote=false
if voteyn=1 then
canvote=true
votetype=checknum(request.form("votetype"))
vote=replace(request.Form("vote"),"|","│")
vote=Server.HTMLEncode(checkstr(vote))
vote=split(vote,chr(13)&chr(10))
voten=ubound(vote)
if voten>bbscon-1 then voten=bbscon-1
for i=0 to voten
if not (vote(i)="" or vote(i)=" ") then
bodyvote=bodyvote&"|"&vote(i)
num=num&"|0"
end if
next
if bodyvote="" then
canvote=false
end if
outtime=checknum(request.form("outtime"))+now()+timezone/24
end if
if canvote=false then votetemp=0
if canvote=true then votetemp=1

dim chstrs,citem
chstrs="title:主题,body:内容"
for each citem in split(chstrs,",")
if trim(request.form(split(citem,":")(0)))="" then
%>
<script language="javascript">
alert("[<%=split(citem,":")(1)%>]为空!")
history.back()
</script>
<%
response.end
end if
next
dim stitle,sbody,uptype
stitle=Server.HTMLEncode(restr(request.form("title")))
sbody=request.form("body")
shtml=checknum(request.form("hx66htm"))
if strlength(stitle)>50 then
%>
<script language="javascript">
alert("标题不得超过50个字节")
history.back()
</script>
<%
response.end
end if
if strlength(sbody)>30000 then
%>
<script language="javascript">
alert("内容不得超过3万个字节")
history.back()
</script>
<%
response.end
end if

function uptypecheck(byval str)
dim ary,pos
ary=split(str,"[upload=")
if ubound(ary)>=1 then
pos=instr(ary(1),"[/upload]")
if pos=0 then exit function
uptypecheck=left(ary(1),3)
end if
end function
uptype=uptypecheck(sbody)

set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from hx66_uinfo where hx66_uname='"&ckuname&"'"
rs.open sqlstr,conn,1,3
if not rs.eof then
rs("hx66_money")=rs("hx66_money")+zpos
rs.update
else
rs.addnew
rs("hx66_uname")=ckuname
rs("hx66_money")=zpos
rs.update
end if
rs.close
sqlstr="select * from hx66_bbs"
rs.open sqlstr,conn,1,3
rs.addnew
rs("hx66_name")=ckuname
rs("hx66_title")=stitle
rs("hx66_body")=sbody
rs("hx66_len")=strlength(sbody)
rs("hx66_bid")=bid
rs("hx66_fatime")=now()
rs("hx66_time")=now()
rs("hf_name")=ckuname
rs("hx66_ip")=IP
rs("hx66_vote")=votetemp
rs("hx66_html")=shtml
rs.update
id=rs("id")
if canvote=true then conn.execute("insert into [hx66_Vote] values("&id&",'"&bodyvote&"','"&num&"',"&votetype&",'"&outtime&"','')")
'更新上传文件
if uptype<>"" and instr(uploadtype,uptype)>0 then
conn.execute("update [upload] set bbsid="&id&",totable="&bid&",url='"&stitle&"' where name='"&ckuname&"' and totable=0")
end if
'更新贴数
conn.execute("update [hx66_bbsset] set todaynum=todaynum+1,topicnum=topicnum+1,allnum=allnum+1")
conn.execute("update [hx66_bbsinfo] set todaynum=todaynum+1,topicnum=topicnum+1,allnum=allnum+1 where id="&bid&"")
response.redirect "bbs_detail.asp?aid="&rs("id")&"&bid="&bid
rs.close
set rs=nothing
end if

if request.querystring("type")="hf" then
dim aid:aid=request.querystring("aid")
if not IsNumeric(aid) or aid="" then
call showmsg("指定的主题并不存在")
else
aid=clng(aid)
end if
if trim(request.form("body"))="" then
%>
<script language="javascript">
alert("回复内容为空")
history.back()
</script>
<%
response.end
end if
dim hfbody,hfhtml
hfbody=request.form("body")
hfhtml=checknum(request.form("hx66htm"))
if strlength(hfbody)>20000 then
%>
<script language="javascript">
alert("回复内容不得超过2万个字节")
history.back()
</script>
<%
response.end
end if

function uptypecheck(byval str)
dim ary,pos
ary=split(str,"[upload=")
if ubound(ary)>=1 then
pos=instr(ary(1),"[/upload]")
if pos=0 then exit function
uptypecheck=left(ary(1),3)
end if
end function
uptype=uptypecheck(hfbody)

set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from hx66_bbs where id="&aid
rs.open sqlstr,conn,1,3
if not rs.eof then
if rs("hx66_close")=1 then
showmsg("该贴已经被关闭,不能回复")
end if
rs("hx66_hf")=rs("hx66_hf")+1
rs("hx66_time")=now()
rs("hf_name")=ckuname
rs.update
else
showmsg("发生错误")
end if
rs.close
sqlstr="select * from hx66_uinfo where hx66_uname='"&ckuname&"'"
rs.open sqlstr,conn,1,3
if not rs.eof then
rs("hx66_money")=rs("hx66_money")+hpos
rs.update
else
rs.addnew
rs("hx66_uname")=ckuname
rs("hx66_money")=hpos
rs.update
end if
rs.close
sqlstr="select * from hx66_saybbs"
rs.open sqlstr,conn,1,3
rs.addnew
rs("hx66_user")=ckuname
rs("hx66_text")=hfbody
rs("hx66_iid")=aid
rs("hx66_time")=now()
rs("hx66_ip")=IP
rs("hx66_html")=hfhtml
rs.update
'更新上传文件
if uptype<>"" and instr(uploadtype,uptype)>0 then
conn.execute("update [upload] set bbsid="&aid&",totable="&bid&",url='回贴' where name='"&ckuname&"' and totable=0")
end if
'更新贴数
conn.execute("update [hx66_bbsset] set todaynum=todaynum+1,allnum=allnum+1")
conn.execute("update [hx66_bbsinfo] set todaynum=todaynum+1,allnum=allnum+1 where id="&bid&"")
response.redirect "bbs_detail.asp?aid="&aid&"&bid="&bid
rs.close
set rs=nothing
end if
conn.close
set conn=nothing
%>

⌨️ 快捷键说明

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