📄 ad_guest.asp
字号:
<%@language=vbscript codepage=936 %>
<%
option explicit
response.buffer=true
Const PurviewLevel=2
Const CheckChannelID=5
Const AdminType=True
'response.write "此功能被暂时禁止了!"
'response.end
dim Action,PurviewLevel_Guest
Action=request("Action")
if Action="" then
Action="Check"
end if
select case Action
case "adminreply"
PurviewLevel_Guest="Reply"
case "del"
PurviewLevel_Guest="Del"
case "pass","nopass"
PurviewLevel_Guest="Check"
case "edit"
PurviewLevel_Guest="Modify"
case else
PurviewLevel_Guest="Manage"
end select
%>
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="ad_ChkPurview.asp"-->
<!--#include file="inc/Conn_User.asp"-->
<!--#include file="inc/ubbcode.asp"-->
<!--#include file="inc/func.asp"-->
<!--#include file="inc/ad_code_guest.asp"-->
<!--#include file="inc/md5.asp"-->
<%
dim strChannel,sqlChannel,rsChannel,ChannelUrl,ChannelName
dim strFileName,MaxPerPage,totalPut,CurrentPage,TotalPages
dim BeginTime,EndTime,founderr, errmsg,i
dim rs,sql,rsGuest,sqlGuest
dim PageTitle,strPath,strPageTitle
dim SkinID,ClassID,AnnounceCount
dim UserGuestName,UserType,UserSex,UserEmail,UserHomepage,UserOicq,UserIcq,UserMsn
dim WriteName,WriteType,WriteSex,WriteEmail,WriteOicq,WriteIcq,WriteMsn,WriteHomepage
dim WriteFace,WriteImages,WriteTitle,WriteContent,SaveEdit,SaveEditId
dim GuestType,LoginName,AdminReplyContent
dim SubmitType,GuestPath,TitleName,keyword
Set rsGuest= Server.CreateObject("ADODB.Recordset")
dim Purview_ReplyGuest,Purview_DelGuest,Purview_CheckGuest,Purview_ModifyGuest
Purview_ReplyGuest=False
Purview_DelGuest=False
Purview_CheckGuest=False
Purview_ModifyGuest=False
if AdminPurview=1 or CheckPurview(AdminPurview_Guest,"Reply")=True then Purview_ReplyGuest=True
if AdminPurview=1 or CheckPurview(AdminPurview_Guest,"Del")=True then Purview_DelGuest=True
if AdminPurview=1 or CheckPurview(AdminPurview_Guest,"Check")=True then Purview_CheckGuest=True
if AdminPurview=1 or CheckPurview(AdminPurview_Guest,"Modify")=True then Purview_ModifyGuest=True
strFileName="ad_Guest.asp"
GuestPath="images/guestbook/"
MaxPerPage=10
SaveEdit=0
if request("page")<>"" then
currentPage=cint(request("page"))
else
currentPage=1
end if
TitleName=ChannelName
select case Action
case "write"
PageTitle="添加留言"
case "savewrite"
PageTitle="保存留言"
case "reply"
PageTitle="回复留言"
case "edit"
PageTitle="编辑留言"
case "adminreply"
PageTitle="管理员回复留言"
case "del"
PageTitle="删除留言"
case "pass"
PageTitle="审核留言"
case "nopass"
PageTitle="取消审核"
case else
PageTitle="网站留言"
end select
SubmitType=request("SubmitType")
select case SubmitType
case "待审留言"
Action="shownopassed"
case "删除留言"
Action="del"
case "通过审核"
Action="pass"
case "取消审核"
Action="nopass"
end select
GuestType=0
if CheckUserLogined()=true then
GuestType=1
LoginName=Trim(Request.Cookies("luyeweb")("UserName"))
end if
keyword=trim(request("keyword"))
if keyword<>"" then
keyword=ReplaceBadChar(keyword)
keyword=Replace(keyword,"[","")
keyword=Replace(keyword,"]","")
end if
if keyword<>"" then TitleName="搜索含有 <font color=red>"&keyword&"</font> 的留言"
%>
<html>
<title>网站留言管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="ad_Style.css" rel="stylesheet" type="text/css">
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<%
call showtip()
call Guestbook()
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr class="tdbg_leftall">
<td>
<%
call ShowGuestPage()
%>
</td>
</tr>
</table>
</body>
</html>
<%
'以下内容syscode_guest.asp与Admin_Guest.asp相同
'=================================================
'过程名:GuestBook()
'作 用:留言本功能调用
'参 数:无
'=================================================
sub GuestBook()
select case Action
case "write"
call WriteGuest()
case "savewrite"
call SaveWriteGuest()
case "reply"
call ReplyGuest()
case "edit"
call EditGuest()
case "adminreply"
call AdimReplyGuest()
case "saveadminreply"
call SaveAdminReplyGuest()
case "del"
call DelGuest()
case "pass"
call PassGuest()
case "nopass"
call PassGuest()
case "user"
call ShowAllGuest(3)
case else
call GuestMain()
end select
end sub
'=================================================
'过程名:GuestMain()
'作 用:留言主函数
'参 数:无
'=================================================
sub GuestMain()
response.write "<form style=""margin:0;padding:0"">"
if action="shownopassed" then
call ShowAllGuest(4)
else
call ShowAllGuest(0)
end if
call ShowGuestBottom()
response.write "</form>"
end sub
'=================================================
'过程名:ShowAllGuest()
'作 用:分页显示所有留言
'参 数:ShowType----- 0为显示所有
' 1为显示已通过审核及用户自己发表的留言
' 2为显示已通过审核的留言(用于游客显示)
' 3为显示用户自己发表的留言
'=================================================
sub ShowAllGuest(ShowType)
if ShowType=1 then
sqlGuest="select * from Guest where (GuestIsPassed=True or GuestName='"&LoginName&"')"
elseif ShowType=2 then
sqlGuest="select * from Guest where GuestIsPassed=True"
elseif ShowType=3 then
sqlGuest="select * from Guest where GuestName='"&LoginName&"'"
elseif ShowType=4 then
sqlGuest="select * from Guest where GuestIsPassed=False"
else
if keyword<>"" then
sqlGuest="select * from Guest where 1"
else
sqlGuest="select * from Guest"
end if
end if
if keyword<>"" then
sqlGuest=sqlGuest & " and (GuestTitle like '%" & keyword & "%' or GuestContent like '%" & keyword & "%' or GuestName like '%" & keyword & "%' or GuestReply like '%" & keyword & "%') "
end if
sqlGuest=sqlGuest&" order by GuestMaxId desc"
set rsGuest=server.createobject("adodb.recordset")
rsGuest.open sqlGuest,conn,1,1
if rsGuest.bof and rsGuest.eof then
totalput=0
response.write "<br><li>没有任何留言</li>"
else
totalput=rsGuest.recordcount
if currentPage=1 then
call ShowGuestList()
else
if (currentPage-1)*MaxPerPage<totalPut then
rsGuest.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rsGuest.bookmark
call ShowGuestList()
else
currentPage=1
call ShowGuestList()
end if
end if
end if
rsGuest.close
set rsGuest=nothing
end sub
'=================================================
'过程名:ShowGuestList()
'作 用:显示留言
'参 数:无
'=================================================
sub ShowGuestList()
dim i,GuestTip,TipName,TipSex,TipEmail,TipOicq,TipHomepage,isdelUser
i=0
do while not rsGuest.eof
isdelUser=0
if rsGuest("GuestType")=1 then
sql="select * from " & db_User_Table & " where " & db_User_Name & "='" & rsGuest("GuestName")&"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,Conn_User,1,1
if not rs.bof and not rs.eof then
UserGuestName=rs(db_User_Name)
UserSex=rs(db_User_Sex)
UserEmail=rs(db_User_Email)
UserOicq=rs(db_User_QQ)
UserIcq=rs(db_User_Icq)
UserMsn=rs(db_User_Msn)
UserHomepage=rs(db_User_Homepage)
else
isdelUser=1
end if
end if
if rsGuest("GuestType")<>1 or isdelUser=1 then
UserGuestName=rsGuest("GuestName")
UserSex=rsGuest("GuestSex")
UserEmail=rsGuest("GuestEmail")
UserOicq=rsGuest("GuestOicq")
UserIcq=rsGuest("GuestIcq")
UserMsn=rsGuest("GuestMsn")
UserHomepage=rsGuest("GuestHomepage")
end if
TipName=UserGuestName
if isdelUser=1 then TipName=TipName&"(已删除)"
if TipEmail="" or isnull(TipEmail) then TipEmail="未填"
if TipOicq="" or isnull(TipOicq) then TipOicq="未填"
if TipHomepage="" or isnull(TipHomepage) then TipHomepage="未填"
if UserIcq="" or isnull(UserIcq) then UserIcq="未填"
if UserMsn="" or isnull(UserMsn) then UserMsn="未填"
if UserSex=1 then
TipSex="(酷哥)"
elseif UserSex=0 then
TipSex="(靓妹)"
else
TipSex=""
end if
GuestTip=" 姓名:"&TipName&" "&TipSex&"<br> 邮件:"&TipEmail&"<br> OICQ:"&TipOicq&"<br> 主页:"&TipHomepage&"<br> 地址:"&rsGuest("GuestIP")&"<br> 时间:"&rsGuest("GuestDatetime")
%>
<SCRIPT language=javascript>
function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.Name != "chkAll"&&e.disabled!=true)
e.checked = form.chkAll.checked;
}
}
</script>
<table width="99%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
<tr>
<tr >
<td align="center" valign="top">
<table width="100%" border="0" cellspacing="2" cellpadding="1" class="title">
<tr>
<td ><font color=green> 主题</font>: <%=KeywordReplace(rsGuest("GuestTitle"))%></td>
<td width="165"> <img src="<%=GuestPath%>posttime.gif" width="11" height="11" align="absmiddle">
<font color="#006633">:
<% =rsGuest("GuestDatetime")%>
</font> </td>
</tr>
</table>
</td>
</tr>
<tr class="tdbg_leftall">
<td align="center" height="153" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<%if rsGuest("GuestIsPassed")=True then%>
<tr class="tdbg_leftall">
<%else%>
<tr bgcolor="#f0f0f0">
<%end if%>
<td width="100" align="center" height="130" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="3" align="center" >
<tr>
<td valign="middle" align="center" width="100%">
<img src="<%=GuestPath%><%=rsGuest("GuestImages")%>.gif" width="80" height="90" onMouseOut=toolTip() onMouseOver="toolTip('<%=GuestTip%>')"><br><br>
<%
if rsGuest("GuestType")=1 then
response.write "<font color=""#006633"">【用户】<br>"&KeywordReplace(UserGuestName)&"</font>"
else
response.write "【游客】<br>"&KeywordReplace(UserGuestName)
end if
%>
</td>
</tr>
</table>
</td>
<td align="center" height="153" width="1" bgcolor="#B4C9E7">
</td>
<td>
<table width="100%" border="0" cellpadding="6" cellspacing="0" class="saytext" height="125" style="TABLE-LAYOUT: fixed">
<tr>
<td align="left" valign="top"><img src="<%=GuestPath%>face<%=rsGuest("GuestFace")%>.gif" width="19" height="19">
<%
if rsGuest("GuestIsPrivate")=true then
response.write "<font color=green>[隐藏]</font> "
end if
response.write KeywordReplace(ubbcode(dvHTMLEncode(rsGuest("GuestContent"))))
%>
</td>
</tr>
<tr>
<td align="left" valign="bottom">
<%call ShowGuestreply()%>
</td>
</tr>
</table>
<table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#B4C9E7">
<tr>
<td></td>
</tr>
</table>
<%call ShowGuestButton()%>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="15" align="center" valign="top">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="13" class="tdbg_left2"></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -