📄 saveditannounce.asp
字号:
<!--#include file="conn.asp"-->
<!-- #include file="inc/char.asp" -->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/grade.asp"-->
<%
dim announceid
dim UserName,cname
dim userPassword
dim useremail
dim Topic
dim body
dim FoundError
dim ErrMsg
dim dateTimeStr
dim newUser
dim UserID
dim ip
dim Expression
dim boardID,rootid
dim signflag
dim mailflag
dim char_changed
if session ("userclass") = user_level8 or session ("userclass") = user_level9 then
char_changed = "[此贴子已经被"&session.contents("username")&"编辑过]"
else
char_changed = "[此贴子已经被作者编辑过]"
end if
'cname=session.contents("username")
cname = Request("username")
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("body")+chr(13)+chr(10)+char_changed+chr(13)
signflag=trim(request("signflag"))
mailflag=trim(request("emailflag"))
FoundError=false
if session.contents("username")="" then
ErrMsg=ErrMsg+"<Br>"+"<li>您还没有登陆呀~"
foundError=True
'判断假如修改者不是版主则判断其权限
elseif session.contents("username")<>cname then
if session ("userclass") <> user_level8 and session ("userclass") <> user_level9 then
ErrMsg=ErrMsg+"<Br>"+"<li>您没有权限编辑该贴子。"
foundError=True
end if
end if
if not isInteger(request("skin")) then
skin=0
elseif request("skin")=0 then
skin=0
elseif request("skin")=1 then
skin=1
else
skin=0
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 UserName="" or strLength(UserName)>20 then
ErrMsg=ErrMsg+"<Br>"+"<li>请输入姓名(长度不能大于20)"
foundError=True
elseif Trim(UserPassWord)="" or strLength(UserPassWord)>10 then
ErrMsg=ErrMsg+"<Br>"+"<li>请输入密码(长度不能大于10)"
foundError=True
end if
if Topic="" then
FoundError=True
if Len(ErrMsg)=0 then
ErrMsg=ErrMsg+"<Br>"+"<li>主题不应为空"
else
ErrMsg=ErrMsg+"<Br>"+"<li>主题不应为空"
end if
elseif strLength(topic)>100 then
FoundError=True
if strLength(ErrMsg)=0 then
ErrMsg=ErrMsg+"<Br>"+"<li>主题长度不能超过100"
else
ErrMsg=ErrMsg+"<Br>"+"<li>主题长度不能超过100"
end if
end if
if strLength(body)>AnnounceMaxBytes then
ErrMsg=ErrMsg+"<Br>"+"<li>发言内容不得大于" & CSTR(AnnounceMaxBytes) & "bytes"
foundError=true
end if
if FoundError=true then
call Error()
else
dim FoundUser
if foundError=false then
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(cname)&"' 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>本主题已经锁定,不能编辑。"
founderror=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
session("subject")=topic
if err.number<>0 then
err.clear
ErrMsg=ErrMsg+"<Br>"+"<li>数据库操作失败,请以后再试"&err.Description
call Error()
else
InsertCursor.close
dataconn.close
set dataconn=nothing
response.redirect("list.asp?boardid="&boardid&"&skin="&skin&"")
end if
end if
end if
end if
conn.close
set conn=nothing
%>
<html>
<head>
<title><%=Forumname%></title>
<link rel="stylesheet" type="text/css" href="forum.css">
</head>
<body bgcolor="#ffffff" alink="#333333" vlink="#333333" link="#333333" topmargin="0" leftmargin="0">
<!--#include file="inc/theme.asp"-->
<!--#include file="footer.asp"-->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -