📄 powereasy.guestbook.asp
字号:
<%
'**************************************************************
' Software name: PowerEasy SiteWeaver
' Web: http://www.powereasy.net
' Copyright (C) 2005-2008 佛山市动易网络科技有限公司 版权所有
'**************************************************************
ChannelID = 4
'Private GuestBook_ManageRubbish, GuestBook_EnableVisitor,
Dim IndexMaxPerPage1, IndexMaxPerPage2, ReplyMaxPerPage, TreeMaxPerPage
'Private EnableGuestBookCheck, GuestBook_IsAssignSort, GuestBook_ShowIP, GuestBook_EnableManageRubbish
'Private NeedlessCheck, arrClass_Input, UserSetting
Private testHTML
Private rsGuest, sqlGuest
Private ReplyId, ShowGStyle
Private WriteName, WriteType, WriteSex, WriteEmail, WriteOicq, WriteIcq, WriteMsn, WriteTopicID
Private WriteHomepage, WriteFace, WriteImages, WriteTitle, WriteContent, WriteIsPrivate, WriteKindId
Private SaveEdit, SaveEditId
Private GImagePath, GFacePath
Private KindName
Dim TopicType
Dim arrMaxPerPage
XmlDoc.Load (Server.MapPath(InstallDir & "Language/Gb2312.xml"))
If IsNull(GuestBook_MaxPerPage) Then
GuestBook_MaxPerPage = "20|||10|||10|||5"
End If
arrMaxPerPage = Split(GuestBook_MaxPerPage, "|||")
'讨论区
IndexMaxPerPage1 = PE_CLng(arrMaxPerPage(0))
'留言本
IndexMaxPerPage2 = PE_CLng(arrMaxPerPage(1))
'回复页
ReplyMaxPerPage = PE_CLng(arrMaxPerPage(2))
'展开树
TreeMaxPerPage = arrMaxPerPage(3)
'检查用户是否登录
UserLogined = CheckUserLogined()
strNavPath = XmlText("BaseText", "Nav", "您现在的位置:") & " <a class='LinkPath' href='" & SiteUrl & "'>" & SiteName & "</a>"
strPageTitle = SiteTitle
Call GetChannel(ChannelID)
If Trim(ChannelName) <> "" And ShowChannelName = True Then
strNavPath = strNavPath & " " & strNavLink & " <a href='" & InstallDir & ChannelDir & "/Index.asp'>" & ChannelName & "</a>"
strPageTitle = strPageTitle & " >> " & ChannelName
End If
'留言板内部参数
SaveEdit = 0
GImagePath = InstallDir & "GuestBook/Images/"
GFacePath = InstallDir & "GuestBook/Images/Face/"
FileName = "index.asp"
KindID = PE_CLng(Trim(Request("KindID")))
TopicType = Trim(Request("topictype"))
'读取查看方式
ShowGStyle = GuestStyle()
If ShowGStyle = 2 Then
MaxPerPage = IndexMaxPerPage2
Else
MaxPerPage = IndexMaxPerPage1
End If
Private Sub ReplaceCommon()
Call ReplaceCommonLabel
strHtml = Replace(strHtml, "{$GuestBook_Search}", GuestBook_Search())
strHtml = Replace(strHtml, "{$GuestBook_top}", GuestBook_Top())
strHtml = Replace(strHtml, "{$GuestBook_Mode}", GuestBook_Mode())
strHtml = Replace(strHtml, "{$GetGKindList}", GetGKindList())
strHtml = Replace(strHtml, "{$ShowGueststyle}", ShowGueststyle())
strHtml = Replace(strHtml, "{$GuestBook_See}", GuestBook_See())
strHtml = Replace(strHtml, "{$GuestBook_Appear}", GuestBook_Appear())
strHtml = Replace(strHtml, "{$PageTitle}", strPageTitle)
strHtml = Replace(strHtml, "{$ShowPath}", strNavPath)
If EnableRss = True Then
strHtml = Replace(strHtml, "{$Rss}", "<a href='" & InstallDir & "Rss.asp?ChannelID=" & ChannelID & "' Target='_blank'><img src='" & strInstallDir & "images/rss.gif' border=0></a>")
Else
strHtml = Replace(strHtml, "{$Rss}", "")
End If
End Sub
'=================================================
'过程名:GuestBook_Top()
'作 用:显示顶部留言功能
'参 数:无
'=================================================
Private Function GuestBook_Top()
Dim strTop
strTop = ""
If UserLogined = True Then
strTop = Replace(XmlText("Guest", "GuestBook_Top/Logined", "<a href='{$FileName}?action=user'><img align=absmiddle src='images/Guest_user.gif' alt='我发表的留言' border='0'></a> <a href='{$FileName}?action=user&topictype=participation'><img align=absmiddle src='images/Guest_participation.gif' alt='我回复的留言' border='0'></a> "), "{$FileName}", FileName)
End If
strTop = strTop & Replace(Replace(Replace(XmlText("Guest", "GuestBook_Top/NoLogin", "<a href='{$FileName}'><img align=absmiddle src='images/Guest_all.gif' alt='查看所有留言' border='0'></a> <a href='Guest_Write.asp?KindID={$KindID}&KindName={$KindName}'><img align=absmiddle src='images/Guest_write.gif' alt='签写新的留言' border='0'></a>"), "{$FileName}", FileName), "{$KindID}", KindID), "{$KindName}", KindName) & vbCrLf
GuestBook_Top = strTop
End Function
'=================================================
'过程名:GuestBook_Mode()
'作 用:显示顶部留言功能
'参 数:无
'=================================================
Private Function GuestBook_Mode()
Dim strTop
strTop = ""
If UserLogined = True Then
strTop = strTop & XmlText("Guest", "GuestBook_Mode/Mode1", "用户模式") & vbCrLf
Else
strTop = strTop & XmlText("Guest", "GuestBook_Mode/Mode2", "游客模式") & vbCrLf
End If
GuestBook_Mode = strTop
End Function
'=================================================
'过程名:GuestBook_See()
'作 用:显示顶部留言功能
'参 数:无
'=================================================
Private Function GuestBook_See()
Dim strTop
strTop = ""
If ShowGStyle = 1 Then
strTop = strTop & XmlText("Guest", "GuestBook_See/Mode1", "讨论区方式") & vbCrLf
Else
strTop = strTop & XmlText("Guest", "GuestBook_See/Mode2", "留言板方式") & vbCrLf
End If
GuestBook_See = strTop
End Function
'=================================================
'过程名:GuestBook_Appear()
'作 用:显示顶部留言功能
'参 数:无
'=================================================
Private Function GuestBook_Appear()
Dim strTop
If CheckLevel = 0 Or NeedlessCheck = 1 Then
strTop = strTop & XmlText("Guest", "GuestBook_Appear/Mode1", "直接发表") & vbCrLf
Else
strTop = strTop & XmlText("Guest", "GuestBook_Appear/Mode2", "审核发表") & vbCrLf
Dim grs
Set grs = Conn.Execute("select count(*) from PE_GuestBook where GuestIsPassed=" & PE_False & "")
strTop = strTop & " " & Replace(XmlText("Guest", "GuestBook_Appear/Count", "有{$GuestNo}条待审核"), "{$GuestNo}", grs(0)) & vbCrLf
Set grs = Nothing
End If
GuestBook_Appear = strTop
End Function
'=================================================
'过程名:GuestBook_Search()
'作 用:显示留言搜索
'参 数:无
'=================================================
Private Function GuestBook_Search()
Dim strGuestSearch
'If GuestBook_IsAssignSort = True Then
'strGuestSearch = Replace(XmlText("Guest", "GuestBook_Search", "<table border='0' cellpadding='0' cellspacing='0'><form method='post' name='SearchForm' action='Search.asp'><tr><td height='30' > <select name='Field' id='1'><option value='Title' selected>留言主题</option><option value='Content'>留言内容</option><option value='Name'>留言人</option><option value='GuestTime'>留言时间</option><option value='Reply'>管理员回复</option></select> </td><td height='30' > <select name='KindID' id='KindID'>{$KindID}</select> </td><td height='30' > <input type='text' name='keyword' size='15' value='关键字' maxlength='45' onFocus='this.select();'> <input type='submit' name='Submit' value='搜索'></td></tr></form></table>"), "{$KindID}", GetGKind_Option(3, KindID))
'Else
strGuestSearch = Replace(XmlText("Guest", "GuestBook_Search", "<table border='0' cellpadding='0' cellspacing='0'><form method='post' name='SearchForm' action='Search.asp'><tr><td height='30' > <select name='Field' id='1'><option value='Title' selected>留言主题</option><option value='Content'>留言内容</option><option value='Name'>留言人</option><option value='GuestTime'>留言时间</option><option value='Reply'>管理员回复</option></select> </td><td height='30' > <select name='KindID' id='KindID'>{$KindID}</select> </td><td height='30' > <input type='text' name='keyword' size='15' value='关键字' maxlength='45' onFocus='this.select();'> <input type='submit' name='Submit' value='搜索'></td></tr></form></table>"), "{$KindID}", GetGKind_Option(1, KindID))
'End If
GuestBook_Search = strGuestSearch
End Function
'=================================================
'过程名:ShowAllGuest()
'作 用:分页显示所有留言
'参 数:ShowType----- 0为显示所有
' 1为显示已通过审核及用户自己发表的留言
' 2为显示已通过审核的留言(用于游客显示)
' 3为显示用户自己发表的留言
' 4为显示推荐精华的留言
' 5为要编辑的留言
' 6为回复页的留言
'=================================================
Private Sub ShowAllGuest(ShowType)
Select Case ShowType
Case 1
sqlGuest = "select * from PE_GuestBook where (GuestIsPassed=" & PE_True & " or GuestName='" & UserName & "')"
Case 2
sqlGuest = "select * from PE_GuestBook where GuestIsPassed=" & PE_True & ""
Case 3
If TopicType <> "" Then
TopicType = ReplaceBadChar(TopicType)
End If
If TopicType = "participation" Then
sqlGuest = "select * from PE_GuestBook where GuestID in (select TopicID from PE_GuestBook where GuestName='" & UserName & "' and TopicID<>GuestId)"
Else
sqlGuest = "select * from PE_GuestBook where GuestName='" & UserName & "'"
End If
Case 4
sqlGuest = "select * from PE_GuestBook where GuestIsPassed=" & PE_True & " and Quintessence=1"
Case 5
sqlGuest = "select * from PE_GuestBook where GuestId=" & PE_CLng(Request("guestid"))
Case 6
sqlGuest = "select * from PE_GuestBook where GuestIsPassed=" & PE_True & " and TopicID=" & PE_CLng(ReplyId) & " order by GuestId asc "
Case Else
sqlGuest = "select * from PE_GuestBook where 1=1"
End Select
If Keyword <> "" Then
Select Case strField
Case "Title"
sqlGuest = sqlGuest & " and GuestTitle like '%" & Keyword & "%' "
Case "Content"
sqlGuest = sqlGuest & " and GuestContent like '%" & Keyword & "%' "
Case "Name"
sqlGuest = sqlGuest & " and GuestName like '%" & Keyword & "%' "
Case "Reply"
sqlGuest = sqlGuest & " and GuestReply like '%" & Keyword & "%' "
Case Else
If IsDate(Trim(Request("keyword"))) = False Then
FoundErr = True
ErrMsg = ErrMsg & "<li>" & XmlText("Guest", "ShowAllGuest/Err1", "输入的关键字不是有效日期!") & "</li>"
Exit Sub
Else
If SystemDatabaseType = "SQL" Then
'如果数据量不大,用datediff是可以的,否则影响性能就最好用>=和 <
' sqlGuest = sqlGuest & " and GuestDatetime = '" & Trim(Request("keyword")) & "' "
'sqlGuest = sqlGuest & " and GuestDatetime between '" & Trim(Request("keyword")) & " 00:00:00' and '" & Trim(Request("keyword")) & " 23:59:59' "
sqlGuest = sqlGuest & " and datediff(day,guestdatetime,'" & Trim(Request("keyword")) & "')=0 "
Else
'sqlGuest = sqlGuest & " and GuestDatetime = #" & Trim(Request("keyword")) & "# "
sqlGuest = sqlGuest & " and GuestDatetime between #" & Trim(Request("keyword")) & " 00:00:00# and #" & Trim(Request("keyword")) & " 23:59:59# "
'sqlGuest = sqlGuest & " and datediff(day,guestdatetime,'" & Trim(Request("keyword")) & "')=0 "
End If
End If
End Select
End If
If KindID <> "" And KindID <> "0" Then
sqlGuest = sqlGuest & " and KindID =" & KindID
End If
If strField = "" And ShowType <> 5 And ShowType <> 6 Then
sqlGuest = sqlGuest & " and TopicID =GuestId"
End If
If ShowType <> 6 Then
sqlGuest = sqlGuest & " order by Ontop desc,GuestMaxId desc"
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -