%@language=vbscript codepage=936 %>
<%
option explicit
response.buffer=true
Const PurviewLevel=2
Const CheckChannelID=5
Const AdminType=True
'response.write "此功能被WEBBOY暂时禁止了!"
'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
%>
<%
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="Admin_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("asp163")("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="搜索含有 "&keyword&" 的留言"
%>
网站留言管理
<%
call showtip()
call Guestbook()
%>
<%
call ShowGuestPage()
%>
<%
'以下内容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 ""
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 "
没有任何留言
"
else
totalput=rsGuest.recordcount
if currentPage=1 then
call ShowGuestList()
else
if (currentPage-1)*MaxPerPage1 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&" 邮件:"&TipEmail&" OICQ:"&TipOicq&" 主页:"&TipHomepage&" 地址:"&rsGuest("GuestIP")&" 时间:"&rsGuest("GuestDatetime")
%>
<%
if rsGuest("GuestType")=1 then
response.write "【用户】 "&KeywordReplace(UserGuestName)&""
else
response.write "【游客】 "&KeywordReplace(UserGuestName)
end if
%>
.gif" width="19" height="19">
<%
if rsGuest("GuestIsPrivate")=true then
response.write "[隐藏] "
end if
response.write KeywordReplace(ubbcode(dvHTMLEncode(rsGuest("GuestContent"))))
%>
<%call ShowGuestreply()%>
<%call ShowGuestButton()%>
<%
rsGuest.movenext
i=i+1
if i>=MaxPerPage then exit do
loop
end sub
'=================================================
'过程名:ShowGuestreply()
'作 用:显示回复留言
'参 数:无
'=================================================
sub ShowGuestreply()
if len(rsGuest("GuestReply")) >0 then
%>
<%
end if
end sub
'**************************************************
'函数名:KeywordReplace
'作 用:标示搜索关键字
'参 数:strChar-----要转换的字符
'返回值:转换后的字符
'**************************************************
function KeywordReplace(strChar)
if strChar="" then
KeywordReplace=""
else
KeywordReplace= replace(strChar,""&keyword&"",""&keyword&"")
end if
end function
'=================================================
'过程名:WriteGuest()
'作 用:签写留言
'参 数:无
'=================================================
sub WriteGuest()
if SaveEdit<>1 then
WriteType=GuestType
WriteName=LoginName
WriteSex="1"
WriteFace="1"
WriteImages="01"
WriteHomepage="http://"
end if
%>
<%=PageTitle%>
<%
end sub
'=================================================
'过程名:ReplyGuest()
'作 用:回复留言
'参 数:无
'=================================================
sub ReplyGuest()
dim ReplyId
ReplyId=request("guestid")
if ReplyId="" then
call Guest_info("
请指定要回复的留言ID!
")
exit sub
else
ReplyId=clng(ReplyId)
sqlGuest="select * from Guest where GuestId=" & ReplyId
end if
set rsGuest=server.createobject("adodb.recordset")
rsGuest.open sqlGuest,conn,1,1
if rsGuest.bof and rsGuest.eof then
response.write "
没有任何留言
"
exit sub
else
WriteTitle="Re: "&rsGuest("GuestTitle")
call ShowGuestList()
end if
rsGuest.close
set rsGuest=nothing
call WriteGuest()
end sub
'=================================================
'过程名:EditGuest()
'作 用:编辑留言
'参 数:无
'=================================================
sub EditGuest()
dim EditId
EditId=request("guestid")
if EditId="" then
call Guest_info("
请指定要编辑的留言ID!
")
exit sub
else
EditId=clng(EditId)
sqlGuest="select * from Guest where GuestId=" & EditId
end if
set rsGuest=server.createobject("adodb.recordset")
rsGuest.open sqlGuest,conn,1,1
if rsGuest.bof and rsGuest.eof then
response.write "
找不到您指定的留言!
"
exit sub
end if
if Purview_ModifyGuest=True then
WriteName=rsGuest("GuestName")
WriteType=rsGuest("GuestType")
WriteSex=rsGuest("GuestSex")
WriteEmail=rsGuest("GuestEmail")
WriteOicq=rsGuest("GuestOicq")
WriteIcq=rsGuest("GuestIcq")
WriteMsn=rsGuest("GuestMsn")
WriteHomepage=rsGuest("GuestHomepage")
WriteFace=rsGuest("GuestFace")
WriteImages=rsGuest("GuestImages")
WriteTitle=rsGuest("GuestTitle")
WriteContent=rsGuest("GuestContent")
SaveEdit=1
SaveEditId=EditId
call ShowGuestList()
call WriteGuest()
else
call Guest_info("
您没有编辑留言的权限!
")
end if
rsGuest.close
set rsGuest=nothing
end sub
'=================================================
'过程名:AdimReplyGuest()
'作 用:站长回复留言
'参 数:无
'=================================================
sub AdimReplyGuest()
dim AdminReplyId
if Purview_ReplyGuest=False then
call Guest_info("
您没有回复留言的权限!
")
else
AdminReplyId=request("guestid")
if AdminReplyId="" then
call Guest_info("
请指定要回复的留言ID!
")
exit sub
else
AdminReplyId=clng(AdminReplyId)
sqlGuest="select * from Guest where GuestId=" & AdminReplyId
end if
set rsGuest=server.createobject("adodb.recordset")
rsGuest.open sqlGuest,conn,1,1
if rsGuest.bof and rsGuest.eof then
response.write "
找不到您指定的留言!
"
exit sub
else
AdminReplyContent=rsGuest("GuestReply")
call ShowGuestList()
end if
rsGuest.close
set rsGuest=nothing
call WriteAdimReplyGuest()
end if
end sub
'=================================================
'过程名:WriteAdimReplyGuest()
'作 用:填写站长回复留言
'参 数:无
'=================================================
sub WriteAdimReplyGuest()
%>
<%=PageTitle%>
<%
end sub
'=================================================
'过程名:ShowGuestbutton()
'作 用:显示留言功能按钮
'参 数:无
'=================================================
sub ShowGuestButton()
response.write "
"
response.write "
"
if UserHomepage="" or isnull(UserHomepage) then
response.write "" & vbcrlf
else
response.write ""
response.write "" & vbcrlf
end if
if UserOicq="" or isnull(UserOicq) then
response.write "" & vbcrlf
else
response.write ""
response.write "" & vbcrlf
end if
if UserEmail="" or isnull(UserEmail) then
response.write "" & vbcrlf
else
response.write ""
response.write "" & vbcrlf
end if
response.write " Msn:" & UserMsn & " I P:" &rsGuest("GuestIP")&"')"">" & vbcrlf
response.write "
"
if Purview_ModifyGuest=True then
response.write ""
response.write "" & vbcrlf
end if
if Purview_ReplyGuest=True then
response.write ""
response.write "" & vbcrlf
end if
if Purview_DelGuest=True then
response.write ""
response.write "" & vbcrlf
end if
if Purview_CheckGuest=True then
if rsGuest("GuestIsPassed")=False then
response.write ""
response.write "" & vbcrlf
else
response.write ""
response.write "" & vbcrlf
end if
end if
response.write " "
response.write "
" & vbcrlf
response.write "
"
end sub
'=================================================
'过程名:DelGuest()
'作 用:删除留言
'参 数:无
'=================================================
sub DelGuest()
dim delid
delid=trim(Request("guestid"))
if delid="" then
call Guest_info("
请指定要删除的留言ID!
")
exit sub
end if
if instr(delid,",")>0 then
delid=replace(delid," ","")
sql="Select * from Guest where GuestID in (" & delid & ")"
else
delid=clng(delid)
sql="select * from Guest where GuestID=" & delid
end if
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open sql,conn,1,3
if rs.bof and rs.eof then
response.write "
找不到您指定的留言!
"
exit sub
end if
if Purview_DelGuest=False then
call Guest_info("
您没有删除留言的权限!
")
else
do while not rs.eof
rs.delete
rs.update
rs.movenext
loop
rs.close
set rs=nothing
response.redirect ComeUrl
end if
end sub
'=================================================
'过程名:PassGuest()
'作 用:审核留言
'参 数:无
'=================================================
sub PassGuest()
dim passid
if Purview_CheckGuest=False then
call Guest_info("
您没有审核留言的权限!
")
else
passid=trim(Request("guestid"))
if passid="" then
call Guest_info("
请指定要审核的留言ID!
")
exit sub
end if
if instr(passid,",")>0 then
passid=replace(passid," ","")
sql="Select * from Guest where GuestID in (" & passid & ")"
else
passid=clng(passid)
sql="select * from Guest where GuestID=" & passid
end if
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open sql,conn,1,3
do while not rs.eof
if Action="pass" then
rs("GuestIsPassed")=True
else
rs("GuestIsPassed")=False
end if
rs.update
rs.movenext
loop
rs.close
set rs=nothing
response.redirect ComeUrl
end if
end sub
'=================================================
'过程名:SaveAdminReplyGuest()
'作 用:保存站长回复留言
'参 数:无
'=================================================
sub SaveAdminReplyGuest()
dim GuestReply,SaveAdminReplyId
dim sqlMaxId,rsMaxId,MaxId
if Purview_ReplyGuest=False then
call Guest_info("
您没有回复留言的权限!
")
else
GuestReply=request("GuestContent")
SaveAdminReplyId=request("guestid")
if SaveAdminReplyId="" then
call Guest_info("
请指定要回复的留言ID!
")
exit sub
end if
sqlMaxId="select max(GuestMaxId) as MaxId from Guest"
set rsMaxId=conn.execute(sqlMaxId)
MaxId=rsMaxId("MaxId")
if MaxId="" or isnull(MaxId) then MaxId=0
set rsGuest=server.createobject("adodb.recordset")
sql="select * from Guest where GuestId="&SaveAdminReplyId
rsGuest.open sql,conn,3,3
if rsGuest.bof and rsGuest.eof then
response.write "
找不到您指定的留言!
"
exit sub
else
rsGuest("GuestMaxId")=MaxId+1
rsGuest("GuestReply")=GuestReply
rsGuest("GuestReplyAdmin")=session("AdminName")
rsGuest("GuestReplyDatetime")=now()
rsGuest.update
end if
rsGuest.close
set rsGuest=nothing
end if
call Guest_info("
您的回复留言已经发送成功!
")
end sub
'=================================================
'过程名:ShowGuestBottom()
'作 用:显示留言底部管理功能
'参 数:无
'=================================================
sub ShowGuestBottom()
dim strTemp
if TotalPut>0 then
strTemp= "
"
strTemp= strTemp & " "
strTemp= strTemp & " 多项操作:"
if Purview_DelGuest=True then
strTemp= strTemp & " "
end if
if Purview_CheckGuest=True then
strTemp= strTemp & " "
strTemp= strTemp & " "
end if
strTemp= strTemp & "选中本页显示的所有留言"
strTemp= strTemp & "