📄 savereannounce.asp
字号:
<%@ LANGUAGE="VBSCRIPT" %>
<!--#include file="conn.asp"-->
<!-- #include file="inc/char.asp" -->
<!-- #include file="inc/const.asp" -->
<%
rem ----------------------
rem ------主程序开始------
rem ----------------------
dim UserName
dim userPassword
dim useremail
dim article
dim Topic
dim body
dim FoundError
dim ErrMsg,somerr
dim dateTimeStr
dim ParentID
dim UserID
dim newUser
dim RootID
dim iLayer
dim iOrders
dim ip
dim announceid
dim Expression
dim FoundUser
dim boardID,top
dim boardtype
dim signflag
dim mailflag
dim TIME_ADJUST
dim rs
dim sql
dim lockboard
dim skin
dim Email,mailbody
rem ------获取参数------
call getInput()
rem -----检查版面ID的合法性------
dim boardRs
set boardRs=conn.execute("select lockboard,boardtype from board where boardid=" & boardid)
if boardRs.bof and boardRs.eof then
Errmsg=ErrMsg+"<Br>"+"<li>你要加贴的版面不存在!"
FoundError=true
else
boardtype=boardRs("boardtype")
lockboard=boardRs("lockboard")
if lockboard=1 then
Errmsg=ErrMsg+"<Br>"+"<li>本版面不允许回复!"
FoundError=true
end if
end if
boardRs.close
set boardRs=nothing
if err.number<>0 then err.clear
rem -----检查user输入数据的合法性------
call chkData()
if foundError=true then
response.write "<link rel=stylesheet type=text/css href=forum.css>"
call Error()
else
call checkUser()
response.write "<html><head><title>"&ForumName&"--我要发言</title>"&_
"<link rel=stylesheet type=text/css href=forum.css>"&_
"<meta HTTP-EQUIV=Content-Type content=""text/html; charset=gb2312""></head>"&_
"<body bgcolor=#ffffff alink=#333333 vlink=#333333 link=#333333 topmargin=0 leftmargin=0>"
%>
<!--#include file="inc/theme.asp"-->
<!--#include file="inc/grade.asp"-->
<!--#include file="inc/email.asp"-->
<%
response.write "<TABLE border=0 width=95% align=center>"&_
"<TBODY><TR>"&_
"<TD vAlign=top width=30% ><img border=0 src='"&logo&"'></TD>"&_
"<TD valign=middle align=top> <img src='"&picurl&"closedfold.gif' border=0> <a href=index.asp>"& ForumName &"</a><br>"&_
" <img src='"&picurl&"bar.gif' border=0 width=15 height=15><img src='pic/openfold.gif' border=0> 发表新帖子"&_
"</TD></TR></TBODY></TABLE>"
if foundError then
call Error()
else
call saveReAnnounce()
end if
end if
set rs=nothing
call endConnection()
rem ----------------------
rem ------主程序结束------
rem ----------------------
rem 检测用户输入数据
sub checkUser()
set rs=server.createobject("adodb.recordset")
sql="select locktopic from bbs1 where announceid="&cstr(rootid)
rs.open sql,conn,1,1
if not rs.eof and not rs.bof then
if rs("locktopic")=1 then
Errmsg=ErrMsg+"<Br>"+"<li>本主题已经锁定,不能发表回复。"
founderror=true
exit sub
end if
end if
rs.close
sql ="select article,username,userpassword,userclass,lockuser,userWealth,userEP,userCP from [user] where username='"&replace(trim(username),"'","''")&"'"
rs.open sql,conn,1,3
if not rs.EOF then
FoundUser=True
end if
if not FoundUser then
Errmsg=ErrMsg+"<Br>"+"<li>本论坛只有<a href=reg.asp>注册用户</a>才能发言!"
founderror=true
elseif UserPassword<>rs("UserPassword") then
ErrMsg=ErrMsg+"<Br>"+"<li>您的密码不正确(可能该名字被他人占用了,请尝试用别的名字)"
foundError=true
elseif rs("lockuser")=1 then
ErrMsg=ErrMsg+"<Br>"+"<li>该用户账号已被锁定,请和管理员联系。"
foundError=true
else
article=rs("article")
userclass=rs("userclass")
if userclass<>18 and userclass<>19 and userclass<>20 then
if article>=point(2) and article<point(3) then
if userclass<>2 then userclass=2
elseif article>=point(3) and article<point(4) then
if userclass<>3 then userclass=3
elseif article>=point(4) and article<point(5) then
if userclass<>4 then userclass=4
elseif article>=point(5) and article<point(6) then
if userclass<>5 then userclass=5
elseif article>=point(6) and article<point(7) then
if userclass<>6 then userclass=6
elseif article>=point(7) and article<point(8) then
if userclass<>7 then userclass=7
elseif article>=point(8) and article<point(9) then
if userclass<>8 then userclass=8
elseif article>=point(9) and article<point(10) then
if userclass<>9 then userclass=9
elseif article>=point(10) and article<point(11) then
if userclass<>10 then userclass=10
elseif article>=point(11) and article<point(12) then
if userclass<>11 then userclass=11
elseif article>=point(12) and article<point(13) then
if userclass<>12 then userclass=12
elseif article>=point(13) and article<point(14) then
if userclass<>13 then userclass=13
elseif article>=point(14) and article<point(15) then
if userclass<>14 then userclass=14
elseif article>=point(15) and article<point(16) then
if userclass<>15 then userclass=15
elseif article>=point(16) and article<point(17) then
if userclass<>16 then userclass=16
elseif article>=point(17) then
if userclass<>17 then userclass=17
end if
end if
sql="update [user] set article=article+1,userWealth=userWealth+"&wealthAnnounce&",userEP=userEP+"&epAnnounce&",userCP=userCP+"&cpAnnounce&",userclass='"&userclass&"' where username='"&replace(trim(username),"'","''")&"'"
conn.execute(sql)
userclass=rs("userclass")
Response.cookies("liulang")("username") = UserName
Response.cookies("liulang")("password") = UserPassWord
Response.cookies("liulang")("userclass") = grade(userclass)
rem 清除图片上传数的限制
response.cookies("liulang")("upNum")=1
Response.cookies("liulang").Expires = dateadd("d","365",date())
Response.cookies("liulang").path=cookiepath
call activeuser()
if lockboard=2 then
if rs("userclass")<>18 and rs("userclass")<>19 and rs("userclass")<>20 then
Errmsg=ErrMsg+"<Br>"+"<li>您没有权限在本版面发布贴子!"
FoundError=true
end if
end if
end if
rs.close
end sub
rem 保存贴子信息
sub saveReAnnounce()
dim rsLayer
set rsLayer=conn.execute("select layer,orders from bbs1 where announceid="&cstr(parentid))
if not(rsLayer.eof and rsLayer.bof) then
if isnull(rsLayer(0)) then
iLayer=0
else
iLayer=rslayer(0)
end if
if isNUll(rslayer(1)) then
iOrders=0
else
iOrders=rsLayer(1)
end if
else
iLayer=0
iOrders=0
end if
rsLayer.close
if rootid<>0 then
iLayer=ilayer+1
conn.execute "update bbs1 set orders=orders+1 where rootid="&cstr(RootID)&" and orders>"&cstr(iOrders)
iOrders=iOrders+1
end if
DateTimeStr=CSTR(now()+TIMEADJUST/24)
Sql="insert into bbs1(Boardid,ParentID,Child,username,topic,body,DateAndTime,hits,length,rootid,layer,orders,ip,Expression,locktopic,signflag,emailflag,istop,isbest,isvote,times) values "&_
"("&_
boardid&","&ParentID&",0,'"&_
username&"','"&_
request("topic")&"','"&_
body&"','"&_
DateTimeStr&"',0,'"&_
strlength(body)&"',"&RootID&","&ilayer&","&iorders&",'"&ip&"','"&_
Expression&"',0,"&signflag&","&mailflag&",0,0,0,0)"
conn.execute(sql)
set rs=conn.execute("select top 1 announceid from bbs1 order by announceid desc")
announceid=rs(0)
if err.number<>0 then
err.clear
ErrMsg=ErrMsg+"<Br>"+"<li>数据库操作失败,请以后再试:"&err.Description
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -