www.gusucode.com > 艺术签名文章资讯网源代码 > 艺术签名文章资讯网源代码/624/GuestBook/editreply.asp

    <!--#include file="config.asp"-->
<!--#include file="../inc/ubbcode.asp"-->
<!--#include file="../inc/cls_editor.asp"-->
<%
Dim Rs, SQL,i,replyid
Dim Facestr,FaceOption,FormatInput
ubb.BasePath = ChannelRootDir
ubb.setUbbcode = Join(Newasp.setUserEditor,"|")
ubb.Keyword = Newasp.ContentKeyword

Newasp.LoadTemplates 9999, 3, 0

HtmlContent = Newasp.HtmlContent
HtmlContent = Replace(HtmlContent,"{$GuestFormContent}", Newasp.HtmlSetting(11))
HtmlContent = Replace(HtmlContent,"{$InstallDir}", Newasp.InstallDir)
HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
'--频道目录
HtmlContent = Replace(HtmlContent,"{$ChannelRootDir}", ChannelRootDir, 1, -1, 1)
HtmlContent = Replace(HtmlContent,"{$CurrentStation}",Newasp.ChannelName)
HtmlContent = Replace(HtmlContent,"{$PageTitle}","编辑回复")
HtmlContent = Replace(HtmlContent,"{$IndexTitle}",strIndexName)
HtmlContent = ReadClassMenu(HtmlContent)
HtmlContent = ReadClassMenubar(HtmlContent)
HtmlContent = HTML.ReadAnnounceList(HtmlContent)
HtmlContent = HTML.ReadStatistic(HtmlContent)
HtmlContent = HTML.ReadUserRank(HtmlContent)
HtmlContent = Replace(HtmlContent, "{$MemberName}", Newasp.membername)
HtmlContent = Replace(HtmlContent,"{$LeastString}", Newasp.LeastString)
HtmlContent = Replace(HtmlContent, "{$MaxString}", Newasp.MaxString)

replyid = Newasp.ChkNumeric(Request("replyid"))
If replyid = 0 Then
	Response.Write"错误的系统参数!"
	Response.End
End If
If Trim(Newasp.membergrade) = "999" Or Trim(Session("AdminName")) <> "" Then
	If Newasp.CheckStr(LCase(Request.Form("action"))) = "save" And Request.Form("action") <> "" Then
		Call SaveGuestReply
	Else
		Call EditGuestReply
	End If
Else
	Call OutAlertScript(Newasp.HtmlSetting(3))
End If

Sub EditGuestReply()
	Set Rs = Newasp.Execute("SELECT * FROM NC_GuestReply WHERE id ="& replyid)
	If Rs.BOF And Rs.EOF Then
		Set Rs = Nothing
		Call OutAlertScript("错误的系统参数!")
	End If
	HtmlContent = Replace(HtmlContent,"{$Action}","save")
	HtmlContent = Replace(HtmlContent,"{$ReplyContent}","<b>留言内容:</b><br>" & ubb.UBBCode(Rs("rContent")))
	HtmlContent = Replace(HtmlContent,"{$SubmitValue}","保存编辑")
	HtmlContent = Replace(HtmlContent, "{$GuestID}", Rs("guestid"))
	HtmlContent = Replace(HtmlContent, "{$ReplyID}", replyid)
	HtmlContent = Replace(HtmlContent,"{$GuestTopic}",Newasp.CheckTopic(Rs("rtitle")))
	HtmlContent = Replace(HtmlContent,"{$UserName}",Newasp.CheckTopic(Rs("rUserName")))
	HtmlContent = Replace(HtmlContent,"{$GuestEmail}","mymail@163.com")
	HtmlContent = Replace(HtmlContent,"{$GuestQQ}","123456789")
	HtmlContent = Replace(HtmlContent,"{$RefererUrl}",Request.ServerVariables("HTTP_REFERER"))

	FaceOption = ""
	For i=1 to 20 
		FaceOption = FaceOption & "<option "
		Facestr="images/" & i & ".gif"
		If LCase(Facestr) = LCase(Rs("rface")) Then FaceOption = FaceOption & "selected "
		FaceOption = FaceOption & "value='" & Facestr &"'>头像" &i &"</option>"
	Next
	HtmlContent = Replace(HtmlContent, "{$FaceOption}", FaceOption)

	FormatInput = "<span style=""background-color: #fFfFff"" id=""myt"" " & Newasp.CheckTopic(Rs("Topicformat")) & " onclick=""javascript:formatbt(this);""  style=""cursor:hand; font-size:11pt"">设置标题样式 ABCdef</span>"
	FormatInput = FormatInput & "<input type=""checkbox"" name=""cancel"" value="""" onclick=""Cancelform()""> 取消格式"
	HtmlContent = Replace(HtmlContent,"{$FormatInput}",FormatInput)
	HtmlContent = Replace(HtmlContent,"{$Topicformat}",Newasp.CheckTopic(Rs("Topicformat")))
	HtmlContent = Replace(HtmlContent,"{$GuestContent}",Server.HTMLEncode(Rs("rContent")))
	'-- 编辑器设置
	Dim oEditor,EditorCode
	Set oEditor = New Editor_Cls
	oEditor.UserMode	= 1
	oEditor.setEditMode	= Newasp.setUserEditor(0)
	oEditor.ChannelID	= ChannelID
	oEditor.Width		= Newasp.setUserEditor(2)
	oEditor.Height		= Newasp.setUserEditor(3)
	oEditor.BasePath	= Newasp.InstallDir & Newasp.setAdminEditor(4)
	oEditor.ToolbarSet	= Newasp.setUserEditor(1)'Default,AdminMode,Simple,UserMode,Basic
	oEditor.Value		= Rs("rContent")
	oEditor.InstanceName	= "content"
	EditorCode = oEditor.CreateEditor()
	Set oEditor = Nothing
	HtmlContent = Replace(HtmlContent, "{$EditorCode}", EditorCode)
	Response.Write HtmlContent
	Rs.Close:Set Rs = Nothing
End Sub

Sub SaveGuestReply()
	On Error Resume Next
	Dim TextContent,ChkPostData
	If Newasp.CheckPost = False Then
		ErrMsg = ErrMsg + "您提交的数据不合法,请不要从外部提交。\n"
		FoundErr = True
	End If
	If Not Newasp.CodeIsTrue() Then
		ErrMsg = ErrMsg + "验证码校验失败,请返回刷新页面再试。两秒后自动返回\n"
		Founderr = True
	End If
	Session("GetCode") = ""
	If Trim(Request.Form("username")) = "" Then
		ErrMsg = ErrMsg + "用户名不能为空\n"
		Founderr = True
	End If
	If Newasp.IsValidStr(Request.Form("username")) = False Then
		ErrMsg = ErrMsg + "用户名中含有非法字符\n"
		Founderr = True
	End If
	If Trim(Request.Form("topic")) = "" Then
		ErrMsg = ErrMsg + "回复主题不能为空\n"
		Founderr = True
	End If
	If Trim(Request.Form("content")) = "" Then
		ErrMsg = ErrMsg + "回复内容不能为空\n"
		Founderr = True
	End If
	If Len(Request.Form("content")) < Newasp.LeastString Then
		ErrMsg = ErrMsg + ("回复内容不能小于" & Newasp.LeastString & "字符!")
		Founderr = True
	End If
	If Len(Request.Form("content")) > Newasp.MaxString Then
		ErrMsg = ErrMsg + ("回复内容不能大于" & Newasp.MaxString & "字符!")
		Founderr = True
	End If
	TextContent = Request.Form("content")
	If Newasp.setUserEditor(0) <> 0 Then
		TextContent = Newasp.HTMLEncodes(TextContent)
	End If
	ChkPostData = Newasp.NeedIsAudit(TextContent,Request.Form("topic") & " " & Request.Form("username"))
	If ChkPostData > 0 Then
		ErrMsg = "请不要发表含有不适当内容的留言,请不要发表广告信息"
		Founderr = True
	End If
	If Founderr = True Then
		Call OutAlertScript(ErrMsg)
		Exit Sub
	End If
	Call PreventRefresh  '防刷新
	Set Rs = Server.CreateObject("ADODB.Recordset")
	SQL = "SELECT * FROM NC_GuestReply WHERE id="& replyid
	Rs.Open SQL,Conn,1,3
		Rs("rusername") = Left(Request.Form("username"),50)
		Rs("Topicformat") = Trim(Request.Form("Topicformat"))
		Rs("rTitle") = Newasp.ChkFormStr(Left(Request.Form("topic"),100))
		Rs("rContent") = Html2Ubb(TextContent)
		Rs("rFace") = Trim(Request.Form("face"))

	Rs.update
	Rs.Close:Set Rs = Nothing
	Call OutputScript(Newasp.HtmlSetting(9),Request.ServerVariables("HTTP_REFERER"))
End Sub
Set HTML = Nothing
CloseConn
%>