⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 remark.asp

📁 WAP手机网页XXXXX WAP手机网页XXXXX
💻 ASP
字号:
<%
Class ImplMocomWAPmoWAPRemark
Private MyAPI
Private MyCore
Private strHandle
Private arr1, arr2

Private Sub Class_Initialize()
    Set MyAPI = New ImplFactory
    Set MyCore = MyAPI.Core
    Set MyXML = MyKernel.XMLParser
End Sub

Private Sub Class_Terminate()
    Set MyCore = Nothing
    Set MyAPI = Nothing
End Sub

Public Sub main()
    strHandle = Request.QueryString("Handle")
    If Not MyCore.CheckContent() Then
        MyXML.Println "找不到您要评论的内容1"
    ElseIf MyCore.Staple("Category") <> wmStapleNormal Then
        MyXML.Println "找不到您要评论的内容2"
    ElseIf MyCore.Staple("Remark") <> 1 Then
        MyXML.Println "找不到您要评论的内容3"
    ElseIf MyCore.Content("Category") <> wmContentNormal Then
        MyXML.Println "找不到您要评论的内容4"
    Else
        MyXML.Println "对[" & MyCore.Content("Title") & "]的评论"
        MyXML.Println String(16, "-")
        arr1 = Array("StapleId", "PageNo", "ContentId", "Intime", "PageId")
        arr2 = Array(MyCore.Staple("SeqId"), MyCore.PageNo, MyCore.Content("SeqId"), MyCore.Content("Intime"), MyCore.PageId)
        If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
            If MyCore.Staple("RemarkType") = 0 And IsGuest() Then
                Call RegisterHint("只有注册用户才能发表评论")
            Else
                Call doPost
            End If
        Else
            Call doGet
        End If
        MyXML.Println CreateA(getURL("content.asp", arr1, arr2), "返回" & MyCore.Content("Title"), getImagePrefix("back.gif"))
        MyXML.Println CreateA(getStapleURL(MyCore.Staple("SeqId"), MyCore.PageNo), "返回" & MyCore.Staple("Title"), getImagePrefix("back.gif"))
    End If
    Call BackHomeX(0)
    Call setLog("remark", 0)
    MyXML.Transform Response
End Sub

Private Sub doGet()
    Call doGetMain
    Call doGetAdd
End Sub

Private Sub doPost()
    Call doPostAdd
End Sub

Private Sub doGetMain()
    Dim clsPage
    Dim rs
    Dim i
    Set clsPage = MyKernel.Page()
    clsPage.PageNum = MyIO.QueryString("Page")
    clsPage.PageSize = 10
    clsPage.DataType = WM_DataType
    clsPage.Increment = "SeqId"
    clsPage.Table = T_REMARK
    clsPage.Where = "ContentId=" & MyCore.Content("SeqId")
    clsPage.Sort = "SeqId DESC"
    clsPage.SortType = True
    Set rs = clsPage.Execute()
    MyXML.Println "共有评论 " & clsPage.TotalRow & " 条"
    If clsPage.TotalRow > 0 Then
        i = 0
        Do While rs.EOF = False And i < clsPage.PageSize
            If rs("UserId") = 0 Then
                MyXML.Println "昵称:" & rs("UserName") & "[游客]"
            ElseIf MyKernel.Config("IsMsgbox") = "1" Then
                MyXML.Printf "昵称:"
                MyXML.Println CreateA(getMsgboxSendURL(rs("UserId")), rs("UserName"), "")
            Else
                MyXML.Println "昵称:" & rs("UserName")
            End If
            MyXML.Println "评论:" & FormatWord(MyKernel.Config("ForbidWord"), rs("Content"))
            MyXML.Println "时间:" & FormatTime(getDate(rs("Intime")), "YYYY-MM-DD HH24:MI:SS")
            MyXML.Println String(16, "-")
            rs.MoveNext
            i = i + 1
        Loop
        If clsPage.PageNum < clsPage.TotalPage Then
            MyXML.Printf CreateA(getURL("remark.asp?Page=" & (clsPage.PageNum + 1), arr1, arr2), "下一页", "")
            MyXML.Printf "|"
            MyXML.Println CreateA(getURL("remark.asp?Page=" & clsPage.TotalPage, arr1, arr2), "最末页", "")
        End If
        If clsPage.PageNum > 1 Then
            MyXML.Printf CreateA(getURL("remark.asp?Page=" & (clsPage.PageNum - 1), arr1, arr2), "上一页", "")
            MyXML.Printf "|"
            MyXML.Println CreateA(getURL("remark.asp", arr1, arr2), "第一页", "")
        End If
        If clsPage.TotalPage > 2 Then
            MyXML.SetF "remark.asp", "get", "", True
            Call setQuery
            MyXML.SetN "StapleId", "hidden", MyCore.Staple("SeqId"), "", "", False
            MyXML.SetN "PageNo", "hidden", MyCore.PageNo, "", "", False
            MyXML.SetN "ContentId", "hidden", MyCore.Content("SeqId"), "", "", False
            MyXML.SetN "Intime", "hidden", MyCore.Content("Intime"), "", "", False
            MyXML.SetN "PageId", "hidden", MyCore.PageId, "", "", False
            MyXML.SetN "Page", "text", "", clsPage.PageNum & "/" & clsPage.TotalPage & "页>>跳到", "页", False, 5, 5, "N*"
            MyXML.SetN "", "submit", "GO", "", "", True
        End If
    End If
    If Not rs Is Nothing Then rs.Close
    Set rs = Nothing
    Set clsPage = Nothing
End Sub

Private Sub doGetAdd()
    If MyCore.Staple("RemarkType") = 0 And IsGuest() Then
        Call RegisterHint("只有注册用户才能发表评论")
    Else
        MyXML.SetF getURL("remark.asp", arr1, arr2), "post", "", True
        If IsGuest() Then
            MyXML.SetN "Nick", "text", "", "您的昵称:", "", True
        End If
        MyXML.SetN "Content", "text", "", "您的评论:", "", True
        MyXML.SetN "", "submit", "确定发表", "", "", True
    End If
End Sub

Private Sub doPostAdd()
    Dim blnError
    Dim strError
    blnError = True
    If MyIO.Parse(KBYTE * 3) <> 0 Then
        strError = "超过最大数据请求长度:" & (KBYTE * 3)
    Else
        Dim strNick
        Dim strContent
        strNick = Trim(MyIO.Form("Nick"))
        strContent = Trim(MyIO.Form("Content"))
        If IsGuest() And Not ValidName(strNick) Then
            strError = "请勿在昵称中使用特殊字符" & strNick
        ElseIf strContent = "" Then
            strError = "请输入您的评论"
        ElseIf getTime(Now()) - atol(MyKernel.Memory("LastRemark")) < atoi(MyKernel.Config("RemarkInterval")) Then
            strError = "感谢您的参与,请不要频繁发表评论1"
        ElseIf atoi(MyKernel.Memory("RemarkTotal")) >= atoi(MyKernel.Config("RemarkTotal")) Then
            strError = "感谢您的参与,请不要频繁发表评论2"
        Else
            blnError = False
            strError = "感谢您的评论"
            Dim strSQL
            Dim lngTime
            lngTime = getTime(Now())
            If MyKernel.Memory("LastRemark") >= lngTime Then
                MyKernel.Memory("RemarkTotal") = atoi(MyKernel.Memory("RemarkTotal")) + 1
            Else
                MyKernel.Memory("RemarkTotal") = 1
            End If
            MyKernel.Memory("LastRemark") = lngTime
            strSQL = "INSERT INTO $(Table) (StapleId,ContentId,Title,Content,UserId,UserName,IPAddr,Intime) VALUES ($(StapleId),$(ContentId),'$(Title)','$(Content)',$(UserId),'$(Nick)','$(IPAddr)',$(Timeval))"
            strSQL = Replace(strSQL, "$(Table)", T_REMARK)
            strSQL = Replace(strSQL, "$(StapleId)", MyCore.Staple("SeqId"))
            strSQL = Replace(strSQL, "$(ContentId)", MyCore.Content("SeqId"))
            strSQL = Replace(strSQL, "$(Title)", SafeString(MyCore.Content("Title")))
            strSQL = Replace(strSQL, "$(Content)", SafeString(strContent))
            If IsGuest() Then
                strSQL = Replace(strSQL, "$(Nick)", strNick)
                strSQL = Replace(strSQL, "$(UserId)", 0)
            Else
                strSQL = Replace(strSQL, "$(Nick)", MyKernel.Memory("Nick"))
                strSQL = Replace(strSQL, "$(UserId)", MyKernel.Memory("UserId"))
            End If
            strSQl = Replace(strSQL, "$(IPAddr)", MyKernel.Env("REMOTE_ADDR"))
            strSQL = Replace(StrSQL, "$(Timeval)", lngTime)
            MyKernel.DB.Exec strSQL
            If Not IsGuest() Then
                strSQL = "UPDATE $(Table) SET REMARKTOTAL=$(RemarkTotal),LASTREMARK=$(Timeval) WHERE SEQID=$(SeqId)"
                strSQL = Replace(strSQL, "$(Table)", T_USER)
                strSQL = Replace(strSQL, "$(RemarkTotal)", MyKernel.Memory("RemarkTotal"))
                strSQL = Replace(StrSQL, "$(Timeval)", lngTime)
                strSQL = Replace(strSQL, "$(SeqId)", MyKernel.Memory("SeqId"))
                MyKernel.DB.Exec strSQL
            End If
            strSQL = "UPDATE $(Table) SET REMARKTOTAL=$(RemarkTotal) WHERE SEQID=$(SeqId)"
            strSQL = Replace(strSQL, "$(Table)", T_CONTENT)
            strSQL = Replace(strSQL, "$(RemarkTotal)", MyCore.Content("RemarkTotal") + 1)
            strSQL = Replace(strSQL, "$(SeqId)", MyCore.Content("SeqId"))
            MyKernel.DB.Exec strSQL
            RemoveCacheZ MyCore.Content("SeqId"), MyCore.Content("Intime"), MyCore.Staple("SeqId")
        End If
    End If
    MyXML.Println strError
    If blnError Then
        Call doGetAdd
    Else
        MyXML.Println CreateA(getURL("remark.asp", arr1, arr2), "查看评论", "")
    End If
End Sub

Public Function newInstance()
    Set newInstance = New ImplMocomWAPmoWAPRemark
End Function
End Class
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -