%@language=vbscript codepage=936 %>
<%
option explicit
response.buffer=true
'强制浏览器重新访问服务器下载页面,而不是从缓存读取页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
%>
<%
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 Action,SubmitType,GuestPath,TitleName,keyword
Set rsGuest= Server.CreateObject("ADODB.Recordset")
'***********************************************************************************************
strPath= " 您现在的位置: " & SiteName & ""
strPageTitle= SiteTitle
if ShowSiteChannel="Yes" then
strChannel= "| "
sqlChannel="select * from Channel order by OrderID"
set rsChannel=server.CreateObject("adodb.recordset")
rsChannel.open sqlChannel,conn,1,1
do while not rsChannel.eof
if rsChannel("ChannelID")=ChannelID then
ChannelUrl=rsChannel("LinkUrl")
ChannelName=rsChannel("ChannelName")
strChannel=strChannel & "" & ChannelName & " | "
else
strChannel=strChannel & "" & rsChannel("ChannelName") & " | "
end if
rsChannel.movenext
loop
rsChannel.close
set rsChannel=nothing
strPath=strPath & " >> " & ChannelName & ""
strPageTitle=strPageTitle & " >> " & ChannelName
end if
BeginTime=Timer
ClassID=0
'*********************************************************************************************
strFileName="GuestBook.asp"
GuestPath="images/guestbook/"
MaxPerPage=10
SaveEdit=0
if request("page")<>"" then
currentPage=cint(request("page"))
else
currentPage=1
end if
TitleName=ChannelName
Action=request("Action")
select case Action
case "write"
PageTitle="签写留言"
case "savewrite"
PageTitle="保存留言"
case "reply"
PageTitle="回复留言"
case "edit"
PageTitle="编辑留言"
case "del"
PageTitle="删除留言"
case else
PageTitle="网站留言"
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&" 的留言"
'=================================================
'过程名:GuestBook_Left()
'作 用:显示左侧留言功能
'参 数:无
'=================================================
sub GuestBook_Left()
set rsGuest=conn.execute("select count(*) from Guest where GuestIsPassed=False")
if GuestType=1 then
response.write " 留言模式:用户模式" & vbcrlf
else
response.write " 留言模式:游客模式" & vbcrlf
end if
if EnableGuestCheck="Yes" then
response.write " 发表模式:审核发表" & vbcrlf
response.write " 待审留言:"&rsGuest(0)&" 条" & vbcrlf
else
response.write " 发表模式:直接发表" & vbcrlf
end if
if GuestType=1 then
response.write "
"
end if
response.write "" & vbcrlf
response.write "
" & vbcrlf
end sub
'=================================================
'过程名:GuestBook_Search()
'作 用:显示留言搜索
'参 数:无
'=================================================
sub GuestBook_Search()
response.write ""
end sub
%>
<%
'=================================================
'过程名:GuestBook()
'作 用:留言本功能调用
'参 数:无
'=================================================
sub GuestBook()
select case Action
case "write"
call WriteGuest()
case "savewrite"
call SaveWriteGuest()
case "reply"
call ReplyGuest()
case "edit"
call EditGuest()
case "del"
call DelGuest()
case "user"
call ShowAllGuest(3)
case else
call GuestMain()
end select
end sub
'=================================================
'过程名:GuestMain()
'作 用:留言主函数
'参 数:无
'=================================================
sub GuestMain()
if GuestType=1 then
ShowAllGuest(1)
else
ShowAllGuest(2)
end if
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 UserEmail="" or isnull(UserEmail) then
TipEmail="未填"
else
TipEmail=UserEmail
end if
if UserOicq="" or isnull(UserOicq) then
TipOicq="未填"
else
TipOicq=UserOicq
end if
if UserHomepage="" or isnull(UserHomepage) then
TipHomepage="未填"
else
TipHomepage=UserHomepage
end if
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&"
主页:"&TipHomepage&"
OICQ:"&TipOicq&"
信箱:"&TipEmail&"
地址:"&rsGuest("GuestIP")&"
时间:"&rsGuest("GuestDatetime")
%>
| 主题: <%=KeywordReplace(rsGuest("GuestTitle"))%> |
:
<% =rsGuest("GuestDatetime")%>
|
|
<%if rsGuest("GuestIsPassed")=True then%>
<%else%>
<%end if%>
.gif" width="80" height="90" onMouseOut=toolTip() onMouseOver="toolTip('<%=GuestTip%>')">
<%
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 and rsGuest("GuestName")<>LoginName then
response.write "
"
response.write "************************************** "
response.write "* 隐藏留言,管理员和留言用户可以看到 * "
response.write "**************************************"
response.write ""
else
if rsGuest("GuestIsPrivate")=true then
response.write "[隐藏] "
end if
response.write KeywordReplace(ubbcode(dvHTMLEncode(rsGuest("GuestContent"))))
end if
%>
|
|
<%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
%>
|
| 管理员[<%=rsGuest("GuestReplyAdmin")%>]回复:
<% =rsGuest("GuestReplyDatetime") %>
|
| <% =KeywordReplace(ubbcode(dvHTMLEncode(rsGuest("GuestReply")))) %> |
|
|
<%
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
%>
<%
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 rsGuest("GuestName")=LoginName and rsGuest("GuestIsPassed")=False 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
'=================================================
'过程名: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 rs("GuestName")<>LoginName or rs("GuestIsPassed")=True then
call Guest_info("您没有使用此功能的权限!")
else
do while not rs.eof
rs.delete
rs.update
rs.movenext
loop
rs.close
set rs=nothing
call Guest_info("删除留言成功!")
end if
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 ""
response.write " " & vbcrlf
if rsGuest("GuestName")=LoginName and rsGuest("GuestIsPassed")=False then
response.write ""
response.write " " & vbcrlf
response.write ""
response.write " " & vbcrlf
end if
response.write " | "
response.write "
"
end sub
%>