<!-- #include file="Inc/Inc.asp" -->
<!-- #include file="Inc/Function.asp" -->

<%Call Head()

if myid=0 Then
Call saycarda("购买")

Response.write "<a href='login.asp?url="&Replace(Replace(R_url(),"sid=","sidoo="),"sid=","sidoo=")&"'>请您先登陆...</a>"& chr(13)

Call headsay()
  Response.end
end if
id=usb(request("id"))
ids=usb(request("class"))
if id="" or IsNumeric(id)=False then
  Call Error("<card title=""购买""><p>ID无效！")
end if
if ids="" or IsNumeric(ids)=False then
  Call Error("<card title=""购买""><p>ID无效！")
end if

set rs=server.CreateObject("ADODB.RecordSet")
rs.Open "Select * from Wzclass where classid="&ids,conn,1,2
if rs.eof then
  rs.close
  set rs=Nothing
  Call Error("<card title=""购买""><p>不存在的栏目！")
end if
if abs(int(myjb)) < rs("cent") then
  rs.close
  set rs=Nothing
  Call Error("<card title=""购买""><p>你的"&getcent&"不够！")
end if

if Instr(","&rs("payID")&",",","&myid&",") = 0 then
  if rs("payID") <> "" then
   rs("payID") = rs("payID")&","&myid
  else
   rs("payID") = myid
  end if
  rs.update
conn.Execute("update Users set myjb=myjb-"&abs(int(rs("cent")))&" Where id="&myid)
end if

Rs.close
set rs=nothing
conn.close
set conn=Nothing
Call cardz("购买","article.asp?class="&ids&"&amp;id="&id&"&amp;sid="&sid&"")
%>
购买成功,正在返回..<br/>
<a href="article.asp?class=<%=ids%>&amp;id=<%=id%>&amp;sid=<%=sid%>">[返回上级]</a><br/>
<%Call headsay()%>