?? 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 + -