📄 write.asp
字号:
<!--#include file="config.asp"-->
<!--#include file="../inc/chkinput.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 = ReadClassMenu(HtmlContent)
HtmlContent = ReadClassMenubar(HtmlContent)
HtmlContent = HTML.ReadAnnounceList(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
Response.Write HtmlContent
End Sub
Sub SaveGuestBook()
On Error Resume Next
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 + "<li>您提交的数据不合法,请不要从外部提交。</li>"
FoundErr = True
End If
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
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(Request.Form("content"))
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 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
Rs("ForbidReply") = Newasp.ChkNumeric(Request.Form("ForbidReply"))
Rs.update
Rs.Close:Set Rs = Nothing
Newasp.DelCahe "RenewStatistics"
Newasp.DelCahe "TotalStatistics"
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 Then
Response.Redirect("index.asp")
Else
Call OutputScript(Newasp.HtmlSetting(2),"index.asp")
End If
End Sub
Set HTML = Nothing
CloseConn
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -