📄 saveditannounce.asp
字号:
<!--#include file="conn.asp"-->
<!-- #include file="inc/char.asp" -->
<!-- #include file="inc/const.asp" -->
<!-- #include file="chkuser.asp" -->
<!-- #include file="inc/theme.asp" -->
<%
dim announceid
dim UserName,cname
dim userPassword
dim useremail
dim Topic
dim body
dim dateTimeStr
dim newUser
dim UserID
dim ip
dim Expression
dim boardID,rootid
dim signflag
dim mailflag
dim char_changed
if boardmaster or master then
char_changed = "[align=right][color=#000066][此贴子已经被"&membername&"于"&Now()&"编辑过][/color][/align]"
else
char_changed = "[align=right][color=#000066][此贴子已经被作者于"&Now()&"编辑过][/color][/align]"
end if
UserName=trim(request("username"))
UserPassWord=trim(request("passwd"))
IP=Request.ServerVariables("REMOTE_ADDR")
Expression=Request.Form("Expression")&".gif"
BoardID=Request("boardID")
AnnounceID=Cstr(Request("ID"))
RootID=request("RootID")
Topic=trim(request("subject"))
Body=request("Content")+chr(13)+chr(10)+char_changed+chr(13)
signflag=trim(request("signflag"))
mailflag=trim(request("emailflag"))
foundErr=false
if founduser=false then
ErrMsg=ErrMsg+"<Br>"+"<li>请登陆后进行修改。"
foundErr=True
elseif membername<>username then
if chkboardmaster(boardid)=false then
ErrMsg=ErrMsg+"<Br>"+"<li>您不是系统管理员或者该版面管理员。"
foundErr=True
end if
end if
if signflag="yes" then
signflag=1
else
signflag=0
end if
if mailflag="yes" then
mailflag=1
else
mailflag=0
end if
if instr(Expression,"face")=0 then
Randomize
Do While Len(rndnum)<1
num1=CStr(Chr((57-48)*rnd+48))
rndnum=rndnum&num1
loop
Expression="face" & rndnum & ".gif"
end if
if chkpost=false then
ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法,请不要从外部提交发言。"
FoundErr=True
end if
if UserName="" or strLength(UserName)>20 then
ErrMsg=ErrMsg+"<Br>"+"<li>请输入姓名(长度不能大于20)"
foundErr=True
elseif Trim(UserPassWord)="" or strLength(UserPassWord)>16 then
ErrMsg=ErrMsg+"<Br>"+"<li>请输入密码(长度不能大于16)"
foundErr=True
end if
if rootid=announceid then
if Topic="" then
foundErr=True
if Len(ErrMsg)=0 then
ErrMsg=ErrMsg+"<Br>"+"<li>主题不应为空"
else
ErrMsg=ErrMsg+"<Br>"+"<li>主题不应为空"
end if
elseif strLength(topic)>100 then
foundErr=True
if strLength(ErrMsg)=0 then
ErrMsg=ErrMsg+"<Br>"+"<li>主题长度不能超过100"
else
ErrMsg=ErrMsg+"<Br>"+"<li>主题长度不能超过100"
end if
end if
else
topic=""
end if
if strLength(body)>AnnounceMaxBytes then
ErrMsg=ErrMsg+"<Br>"+"<li>发言内容不得大于" & CSTR(AnnounceMaxBytes) & "bytes"
foundErr=true
end if
stats=boardtype & "编辑帖子成功"
if foundErr=true then
call nav()
call headline(2)
call Error()
call endline()
else
call nav()
call headline(2)
call saveedit()
end if
sub saveedit()
DateTimeStr=CSTR(NOW()+TIMEADJUST/24)
dim cmdTemp
dim InsertCursor
dim dataconn
Set DataConn = Server.CreateObject("ADODB.Connection")
dataconn.open connstr
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set InsertCursor = Server.CreateObject("ADODB.Recordset")
cmdTemp.CommandText="SELECT *, UserName FROM bbs1 where username='"&trim(username)&"' and AnnounceID="&AnnounceID
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = dataconn
InsertCursor.Open cmdTemp, , 1, 3
if InsertCursor.eof then
response.write"<script language=Javascript>"
response.write"alert('错误:您不是本帖子的作者,无权修改!!');"
response.write"location.href = 'javascript:history.back()'"
response.write"</script>"
set InsertCursor=nothing
response.end()
elseif InsertCursor("locktopic")=1 then
Errmsg=ErrMsg+"<Br>"+"<li>本主题已经锁定,不能编辑。"
foundErr=true
call error()
else
InsertCursor("Topic") =Topic
InsertCursor("Body") =Body
InsertCursor("DateAndTime") =DateTimeStr
InsertCursor("length")=strlength(body)
InsertCursor("ip")=ip
InsertCursor("Expression")=Expression
InsertCursor("signflag")=signflag
InsertCursor("emailflag")=mailflag
InsertCursor.Update
if err.number<>0 then
err.clear
ErrMsg=ErrMsg+"<Br>"+"<li>数据库操作失败,请以后再试"&err.Description
call Error()
else
InsertCursor.close
dataconn.close
set dataconn=nothing
call success()
end if
end if
end sub
sub success()
response.write "<meta http-equiv=refresh content=""4;URL=list.asp?boardid="&boardid&""">"
response.write "<br><table cellpadding=0 cellspacing=0 border=0 width="&tablewidth&" bgcolor="&tablebackcolor&" align=center>"&_
"<tr><td><table cellpadding=3 cellspacing=1 border=0 width=""100%"">"&_
"<tr align=center><td width=""100%"" bgcolor="&tabletitlecolor&"><b><FONT COLOR="&TableFontcolor&">状态:您发表帖子成功</font></b></td>"&_
"</tr><tr><td width=""100%"" bgcolor="&tablebodycolor&">"&_
"<FONT COLOR="&TableContentcolor&">本页面将在3秒后自动返回您所发表的帖子页面,<b>您可以选择以下操作:</b><br><ul>"&_
"<li><a href=""index.asp""><font color="""&TableContentcolor&""">返回首页</font></a></li>"&_
"<li><a href=""list.asp?boardid="&boardid&"""><font color="""&TableContentcolor&""">"&boardtype&"</font></a></li>"&_
"</ul></td></tr></table></td></tr></table>"
call endline()
end sub
%>
<!--#include file="footer.asp"-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -