'**************************************
'** edit.asp
'**
'** 文件说明:留言修改页面
'** 修改日期:2006-04-30
'** 作者:Howlion
'** Email:howlion@163.com
'**************************************
if not login then
errinfo="您未登陆或已经退出登陆,不能进入该页。"
call showError()
end if
select case Request.QueryString("act")
case "update"
call update()
case else
pagename="编辑留言"
call bodySkin()
sub pageContent()
showEdit()
end sub
end select
function showEdit()
dim id
id=request.querystring("id")
sql="select usertitle,usercontent,checked from [topic] where id="&id
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if rs.eof and rs.bof then
rs.close
set rs=nothing
errinfo="该留言不存在。"
call showError()
end if
dim re,Referer
Referer=Request.ServerVariables("HTTP_REFERER")
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern="(\?|&)#(.*)"
Referer=re.Replace(Referer,"")
set re=nothing
%>
标题:
*** 正文:
提示:如果留言被编辑,将会自动通过审核。
rs.close
set rs=nothing
end function
sub update() '//////// 更新内容
dim id,Referer,username,userURL,usermail,userqq,usertitle,usercontent
id=request.form("id")
Referer=request.form("Referer")
usertitle=trim(request.form("usertitle"))
usercontent=request.form("usercontent")
if len(usertitle)>50 then
errinfo=errinfo & "过长的标题"
end if
if usercontent="" then
errinfo=errinfo & "未填写留言内容"
end if
call showError()
set rs= server.createobject("adodb.recordset")
sql="select * from [topic] where id="&id
rs.open sql,conn,3,2
rs.update
rs("usertitle")=usertitle
rs("usercontent")=usercontent
rs("checked")=1
rs.update
rs.close
set rs=nothing
if instr(Referer,"=")>0 then
Referer = Referer & "msg" & id
else
Referer = Referer & "?#msg" & id
end if
response.redirect Referer
response.flush
end sub
%>