www.gusucode.com > 艺术签名文章资讯网源代码 > 艺术签名文章资讯网源代码/624/GuestBook/write.asp
<!--#include file="config.asp"--> <!--#include file="../inc/chkinput.asp"--> <!--#include file="../inc/cls_editor.asp"--> <% Dim Rs, SQL,i Dim Facestr,FaceOption,FormatInput,strEmotion Newasp.LoadTemplates 9999, 3, 0 HtmlContent = Newasp.HtmlContent HtmlContent = Replace(HtmlContent,"{$GuestFormContent}", Newasp.HtmlSetting(10)) 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) If CInt(Newasp.AppearGrade) > 0 And Trim(Session("AdminName")) = Empty Then If CInt(Newasp.AppearGrade) > CInt(Newasp.membergrade) Then Call OutputScript(Newasp.HtmlSetting(1),"index.asp") Response.End End If End If If Newasp.CheckStr(LCase(Request.Form("action"))) = "save" And Request.Form("action") <> "" Then Call SaveGuestBook Else Call WriteGuestBook End If Sub WriteGuestBook() HtmlContent = Replace(HtmlContent,"{$Action}","save") HtmlContent = Replace(HtmlContent,"{$SubmitValue}","发表新留言") HtmlContent = Replace(HtmlContent, "{$GuestID}", "") HtmlContent = Replace(HtmlContent,"{$GuestTopic}","") HtmlContent = Replace(HtmlContent,"{$UserName}",Newasp.membername) HtmlContent = Replace(HtmlContent,"{$GuestEmail}","") HtmlContent = Replace(HtmlContent,"{$GuestQQ}","") HtmlContent = Replace(HtmlContent,"{$HomePage}","http://") HtmlContent = Replace(HtmlContent,"{$SelectOption}","<option value=""未知"">请选择</option>") HtmlContent = Replace(HtmlContent,"<!--发表留言表单 @Begin-->",vbNullString) HtmlContent = Replace(HtmlContent,"<!--发表留言表单 @End-->",vbNullString) FaceOption = "" For i=1 to 20 FaceOption = FaceOption & "<option " Facestr="images/" & i & ".gif" FaceOption = FaceOption & "value='" & Facestr &"'>头像" &i &"</option>" Next HtmlContent = Replace(HtmlContent, "{$FaceOption}", FaceOption) If CInt(Newasp.membergrade) > 1 Or Trim(Session("AdminName")) <> "" Then FormatInput = "<span style=""background-color: #fFfFff"" id=""myt"" 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) Else HtmlContent = Replace(HtmlContent,"{$FormatInput}","") End If HtmlContent = Replace(HtmlContent,"{$Topicformat}","") strEmotion = "<input type=""radio"" value=""emot/1.gif"" name=""emot"" checked><img src=""emot/1.gif""> " For i = 2 To 26 If i = 14 then strEmotion = strEmotion & "<br>" strEmotion = strEmotion & "<input type=radio name=emot value=emot/" & i & ".gif ><img src=""emot/" & i & ".gif""> " Next HtmlContent = Replace(HtmlContent,"{$EmotionInput}",strEmotion) HtmlContent = Replace(HtmlContent,"{$GuestContent}","") HtmlContent = Replace(HtmlContent,"{$ForbidChecked}","") HtmlContent = Replace(HtmlContent,"{$IsAdminChecked}","") If CInt(Newasp.membergrade) = 999 Or Trim(Session("AdminName")) <> "" Then HtmlContent = Replace(HtmlContent,"{$IsTopChecked}","") Else HtmlContent = Replace(HtmlContent,"{$IsTopChecked}"," disabled") End If If CInt(Newasp.IsAuditing) = 0 Or CInt(Newasp.membergrade) = 999 Or Trim(Session("AdminName")) <> "" Then HtmlContent = Replace(HtmlContent,"{$IsAcceptChecked}"," checked") Else HtmlContent = Replace(HtmlContent,"{$IsAcceptChecked}"," disabled") End If '-- 编辑器设置 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.InstanceName = "content" EditorCode = oEditor.CreateEditor() Set oEditor = Nothing HtmlContent = Replace(HtmlContent, "{$EditorCode}", EditorCode) Response.Write HtmlContent End Sub Sub SaveGuestBook() On Error Resume Next Dim TextContent,ChkPostData If CInt(Newasp.AppearGrade) > 0 And Trim(Session("AdminName")) = Empty Then If CInt(Newasp.AppearGrade) > CInt(Newasp.membergrade) Then ErrMsg = ErrMsg + "<li>对不起!你没有发表留言的权限。</li><li>如果你是本站会员, 请先<a href=""../user/"">登陆</a>!</li>" FoundErr = True End If End If 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("GuestEmail")) = "" Then ErrMsg = ErrMsg + "用户邮箱不能为空\n" Founderr = True End If If Not IsValidEmail(Request.Form("GuestEmail")) 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")) < Clng(Newasp.LeastString) Then ErrMsg = ErrMsg + ("留言内容不能小于" & Newasp.LeastString & "字符!") Founderr = True End If If Len(Request.Form("content")) > Clng(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 = 1 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_GuestBook WHERE (guestid is null)" Rs.Open SQL,Conn,1,3 Rs.Addnew If Newasp.membername <> "" And Newasp.memberid <> "" Then Rs("userid") = Newasp.memberid Rs("username") = Newasp.membername Else Rs("userid") = 0 Rs("username") = Left(Request.Form("username"),50) End If Rs("Topicformat") = Trim(Request.Form("Topicformat")) Rs("title") = Newasp.ChkFormStr(Left(Request.Form("topic"),100)) Rs("content") = Html2Ubb(TextContent) Rs("face") = Trim(Request.Form("face")) Rs("emot") = Trim(Request.Form("emot")) Rs("HomePage") = Newasp.CheckStr(Left(Request.Form("HomePage"),100)) Rs("GuestEmail") = Newasp.CheckStr(Trim(Request.Form("GuestEmail"))) Rs("GuestOicq") = Newasp.CheckStr(Left(Request.Form("GuestOicq"),30)) Rs("ComeFrom") = Trim(Request.Form("ComeFrom")) Rs("WriteTime") = Now() Rs("lastime") = Now() Rs("GuestIP") = Newasp.GetUserIP Rs("ReplyNum") = 0 Rs("isAdmin") = Newasp.ChkNumeric(Request.Form("isAdmin")) Rs("isTop") = Newasp.ChkNumeric(Request.Form("isTop")) If ChkPostData = 2 Then Rs("isAccept") = 0 Else If CInt(Newasp.IsAuditing) = 0 Or CInt(Newasp.membergrade) = 999 Or Trim(Session("AdminName")) <> "" Then Rs("isAccept") = Newasp.ChkNumeric(Request.Form("isAccept")) Else Rs("isAccept") = 0 End If End If Rs("ForbidReply") = Newasp.ChkNumeric(Request.Form("ForbidReply")) Rs.update Rs.Close:Set Rs = Nothing Dim GroupSetting If Trim(Newasp.membername) <> "" And Trim(Newasp.membergrade) <> "" Then GroupSetting = Split(Newasp.UserGroupSetting(CInt(Newasp.membergrade)), "|||") Newasp.Execute ("UPDATE NC_User SET userpoint = userpoint + " & CLng(GroupSetting(26)) & " WHERE userid="& CLng(Newasp.memberid)) End If If CInt(Newasp.IsAuditing) = 0 And ChkPostData = 0 Then Response.Redirect("index.asp") Else Call OutputScript(Newasp.HtmlSetting(2),"index.asp") End If End Sub Set HTML = Nothing CloseConn %>