<!-- #include file="Inc/Inc.asp" -->
<!-- #include file="Inc/Function.asp" -->
<%call head()
Call saycardd("收藏书签")
'-------A登录信息
if myid=0 then
Response.write "<a href='login.asp?saytk="&saytk&"'>请您先登陆...</a>"& chr(13)
  Response.write "<br/><anchor><prev/>返回</anchor>" & chr(13)
  call head3()
  Response.end
end if

'==========得到URL
function ForUrl(str)
  ForUrl = str
  ForUrl = Replace(Replace(Replace(ForUrl,"-w-","?"),"-a-","&amp;"),"-d-","=")
end function

dim sql,id,url,ids,cid
id=trim(request("id"))
url=trim(request("url"))
ids=trim(request("class"))

if ID = "" or IsNumeric(ID) = False then
  Call Error("ID错误！")
end if

dim linkname,linkurl
set Rs=Server.CreateObject("ADODB.Recordset")
if instr(url,"article")>0 then
Sql="select title from [sms] Where ID="&ID
else
Sql="select name from [wjfile] Where ID="&ID
end if
Rs.open Sql,conn,1,1
If rs.eof Then
  Call Error("不存在的记录！")
end if
if instr(url,"article")>0 then
linkname=rs("title")
cid=2
else
linkname=rs("name")
cid=3
end if
rs.close
set rs=nothing
linkurl=ForUrl(url)&"&amp;sid=[sid]"
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from [mysq] where urlsq='"&linkurl&"' and cid="&cid&" and ids="&myid
rs.open sql,conn,1,2
if rs.eof then
rs.addnew
rs("title")=linkname
rs("urlsq")=linkurl
rs("ids")=myid
rs("cid")=cid
rs("gxtime")=now()
rs.update
response.write"成功将该书签收藏<br/>"
Else
response.write"该书签已经在您的收藏中了<br/>"
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
if instr(url,"article")>0 then
response.write"<a href='article.asp?id="&id&"&amp;class="&ids&"&amp;sid="&sid&"&amp;saytk="&saytk&"'>返回上级</a>"
else
response.write"<a href='picview.asp?id="&id&"&amp;class="&ids&"&amp;sid="&sid&"&amp;saytk="&saytk&"'>返回上级</a>"
end if
response.write"<br/><a href='/bbs/mybook.asp?sid="&sid&"&amp;saytk="&saytk&"'>[我的书签]</a><br/>"
call headsay()%>
