<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->
<%call head()
%>
<%call Fortxtmsg
dim Action
dim ID,urls
ID  = trim(Request.QueryString("ID"))
urls = trim(Request.QueryString("url"))
if urls="" then urls="msgfv.asp?sid="&sid&"&amp;saytk="&saytk&""

if ID = "" or IsNumeric(ID) = False then
  Call Error("<p>ID无效！")
end if

dim acok
acok = trim(Request.QueryString("acok"))
Action=Request.QueryString("Action")
IF  Action="del" Then
	call msgfvdel
else

	call msgfvget
end if
sub msgfvget
call saycardd("收藏消息")

if acok <> "ok" then
  conn.close
  set conn=Nothing
  response.write "<p>确定收藏？"
  response.write "<br/><a href='msgfvsave.asp?ID="&ID&"&amp;acok=ok&amp;sid="&sid&"&amp;saytk="&saytk&"'>是的</a>"
  response.write "<br/><anchor><prev/>取消</anchor>"
call head1()
  response.end
end if

'限50条
set rs=server.CreateObject("ADODB.RecordSet")
rs.Open "select ID from Guest where sid="&myid&" and book = 1",conn,1,1
if rs.RecordCount >= 50 then
  rs.close
  set rs=Nothing
  conn.close
  set conn=Nothing
  response.write "<p>最多只能收藏50条留言！"
  response.write "<br/><a href='guestview.asp?ID="&ID&"&amp;sid="&sid&"&amp;saytk="&saytk&"'>返回</a>"
  call head1()
  response.end
end if
rs.close

rs.Open "select book from Guest where sid="&myid&" and ID="&ID,conn,1,2
if not rs.eof then
  rs("book") = 1
  rs.update
end if
rs.close
set rs=nothing
conn.close
set conn=Nothing
urls=replace(urls,"@@","&amp;")
urls=replace(urls,"sidoo=","sid=")
urls=replace(urls,"sid=&sid=","sid=")
urls=replace(urls,"sid=&amp;sid=","sid=")
urls=replace(urls,"sid=@@sid=","sid=")
response.write "<p>收藏成功！"&chr(13)
response.write "<br/><a href='"&urls&"'>返回上级</a>"
call head1()
end sub
Sub msgfvdel
call saycardd("删除收藏")

if acok <> "ok" then
  conn.close
  set conn=Nothing


  response.write "<br/><a href='msgfvsave.asp?action=del&amp;ID="&ID&"&amp;acok=ok&amp;sid="&sid&"&amp;saytk="&saytk&"'>是的</a>"
  response.write "<br/><anchor><prev/>取消</anchor>"
  call head1()
  response.end
end if
set rs=server.CreateObject("ADODB.RecordSet")
rs.Open "select book from Guest where sid="&myid&" and ID="&ID,conn,1,2
if not rs.eof then
  rs("book") = 0
  rs.update
end if
rs.close
set rs=nothing
conn.close
set conn=Nothing
urls=replace(urls,"@@","&amp;")
urls=replace(urls,"sidoo=","sid=")
urls=replace(urls,"sid=&sid=","sid=")
urls=replace(urls,"sid=&amp;sid=","sid=")
urls=replace(urls,"sid=@@sid=","sid=")
  response.write "删除成功"
response.write "<br/><a href='"&urls&"'>返回上级</a>"
call head1()
end sub 
%>