<!--#include file="../inc.asp"-->
<!--#include file="../ydzq.asp"-->
<!--#include file="conn.asp"-->
<%Call head()
'if GiftsSwitch<>1 then
'call saycardd("礼品商城")
		'if keys=1 then
		'response.write"请先进行<a href=""admin.asp?info=e&amp;saytk="&saytk&"&amp;sid="&sid&""">基本设置</a>"
		'else
		'response.write"商城还没开放,请返回<a href=""/bbs/index.asp?saytk="&saytk&"&amp;sid="&sid&""">社区首页</a>"
		'end if
		'call head1()
	'response.End()
	'end if
Counts=Giftsconn.execute("select sum(Amount) from keep where lx=0 and uid="&myid)(0)
if Isnumeric(Counts)=False then Counts=0
Counts1=Giftsconn.execute("select sum(Amount) from keep where lx=1 and uid="&myid)(0)
if Isnumeric(Counts1)=False then Counts1=0
'Counts=Giftsconn.execute("Select count(id) from keep where uid="&myid)(0)
dim info,ino
info=request("info")
ino=request("ino")
Select Case info
	Case "a"
	if ino="a" then msg="最慷慨达人-top10"
	if ino="b" then msg="收礼达人-top10"
	
	call saycardd(""&msg&"")
call doin("",""&msg&"")
	Call aa()
		Call a()
	Case "b"  
		call saycardd("赠送礼物")
call doin("","赠送礼物")
	Call aa()
		Call b()
	Case "c"  
	if ino="a" then msg="热销礼物"
	if ino="b" then msg="新品上架"
	if ino="c" then msg="礼物大厅"
	if ino="d" then msg="我的储物箱"
	if ino="e" then msg="我收到的礼物"
	if ino="f" then msg="友友动态"
	if ino="g" then msg="送礼清单"
	call saycardd(""&msg&"")
call doin("",""&msg&"")
	Call aa()
		Call c()
	Case "d"  
	call saycardd("购买礼物")
call doin("","购买礼物")
	Call aa()
		Call d()
	Case "e"  
	call saycardd("删除礼物")
call doin("","删除礼物")
	Call aa()
		Call e()
	Case else
	call saycardd("礼品商城")
call doin("","礼品商城")
	response.write"<img src='logo.gif' alt='..'/><br/>"
	Call aa()
		Call l()
end select 

sub l()
Session("QYCID") = ""
response.write"欢迎<a href='../show.asp?saytk="&saytk&"&amp;sid="&sid&"'>"&myni&"</a><br/>"
Response.write css("[\a]")&"〓我的礼物〓<br/>"&css("[a/]")
Response.write "<a href=""index.asp?info=c&amp;ino=e&amp;saytk="&saytk&"&amp;sid="&sid&""">我收到的礼物("&Counts1&"件)</a><br/>"
Response.write "<a href=""index.asp?info=c&amp;ino=d&amp;saytk="&saytk&"&amp;sid="&sid&""">我的储物箱("&Counts&"件)</a><br/>"
	Response.write css("[\a]")&"〓热销礼物〓<br/>"&css("[a/]")
	set rs=Sersaytkr.CreateObject("ADODB.Recordset")
	rs.open"select * from txt where Amount>0 order by Amount1 desc",Giftsconn,1,1
	if not rs.eof then
	for i=1 to 3
	if i=1 then  
	response.write "<img src='"&rs("url")&"' alt='..'/><br/><a href=""index.asp?info=d&amp;id="&rs("id")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&rs("nane")&"</a><br/>简介:"&rs("txta")&"<br/>价格:"&rs("Price")&getcent&"<br/>--该礼物已卖出"&rs("Amount1")&"件--<br/>----------<br/>"
	else
	response.write "<a href=""index.asp?info=d&amp;id="&rs("id")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&rs("nane")&"</a>["&rs("Price")&getcent&"]<br/>"
	end if
	rs.Mosaytknext
	if rs.EOF then Exit for 
	next 
	end if
	rs.close
	set rs=nothing 
Response.write "<a href=""index.asp?info=c&amp;ino=a&amp;saytk="&saytk&"&amp;sid="&sid&""">更多热销礼物>></a><br/>"
	Response.write css("[\a]")&"〓新品上架〓<br/>"&css("[a/]")
	set rs=Sersaytkr.CreateObject("ADODB.Recordset")
	rs.open"select * from txt where Amount>0 order by id desc",Giftsconn,1,1
	if not rs.eof then
	for i1=1 to 3
	if i1=1 then  
	response.write "<img src='"&rs("url")&"' alt='..'/><br/><a href=""index.asp?info=d&amp;id="&rs("id")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&rs("nane")&"</a><br/>简介:"&rs("txta")&"<br/>价格:"&rs("Price")&getcent&"<br/>--该礼物已卖出"&rs("Amount1")&"件--<br/>----------<br/>"
	else
	response.write "<a href=""index.asp?info=d&amp;id="&rs("id")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&rs("nane")&"</a>["&rs("Price")&getcent&"]<br/>"
	end if
	rs.Mosaytknext
	if rs.EOF then Exit for 
	next 
	end if
	rs.close
	set rs=nothing 
Response.write "<a href=""index.asp?info=c&amp;ino=b&amp;saytk="&saytk&"&amp;sid="&sid&""">更多新品上架>></a><br/>"
Response.write css("[\a]")&"〓<a href=""index.asp?info=c&amp;ino=c&amp;saytk="&saytk&"&amp;sid="&sid&""">礼物大厅</a>〓<br/>"&css("[a/]")
	dim n2,ranNum2 
	n2 = 3
	set rs=Sersaytkr.CreateObject("ADODB.Recordset")
	rs.open"select * from lx order by id desc",Giftsconn,1,1
	Randomize() 
	ranNum2 = rs.recordCount-n2 
	if ranNum2<1 then ranNum2=1 
	ranNum2 = int(ranNum2*rnd)+1 
	rs.Mosaytk ranNum2 
	for i2=1 to 3
	response.write "<a href=""index.asp?info=c&amp;ino=c&amp;lxid="&rs("id")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&rs("nane")&"</a>"
	if i2=3 then 
	response.write "<br/>"
	else
	response.write "|"
	end if
	rs.MosaytkNext '挨着向下读取 
	next 
	rs.close
	set rs=nothing 
response.write css("[\a]")&"〓<a href=""index.asp?info=c&amp;ino=f&amp;saytk="&saytk&"&amp;sid="&sid&""">好友动态</a>〓<br/>"&css("[a/]")
response.write gametalk(3)
response.write css("[\a]")&"〓礼物榜单〓<br/>"&css("[a/]")
response.write "<a href=""index.asp?info=a&amp;ino=a&amp;saytk="&saytk&"&amp;sid="&sid&""">最慷慨达人</a>|<a href=""index.asp?info=a&amp;ino=b&amp;saytk="&saytk&"&amp;sid="&sid&""">收礼达人</a><br/>"

end sub

sub a()
if ino="a" then
response.write "最慷慨达人-TOP10|<a href=""index.asp?info=a&amp;ino=b&amp;saytk="&saytk&"&amp;sid="&sid&""">收礼达人</a><br/>"
mmsg="select top 10 * from Record1 order by Send desc"
else
response.write "<a href=""index.asp?info=a&amp;ino=a&amp;saytk="&saytk&"&amp;sid="&sid&""">最慷慨达人</a>|收礼达人-TOP10<br/>"
mmsg="select top 10 * from Record1 order by Closea desc"
end if
	set rs=Sersaytkr.CreateObject("ADODB.Recordset")
	rs.open mmsg,Giftsconn,1,1
	if not rs.eof then
	for ir=1 to 10
	response.write "第"&ir&"名.<a href=""/bbs/uinfo.asp?id="&rs("uid")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&myname(rs("uid"))&"</a>"
	if ino="a" then response.write "送礼"&rs("Send")&"件<br/>"
	if ino="b" then response.write "收礼"&rs("Closea")&"件<br/>"
	rs.Mosaytknext
	if rs.EOF then Exit for 
	next 
	else
	response.write "暂时没有记录<br/>"
	end if
	rs.close
	set rs=nothing 
end sub

sub b()
dim paycent,about,num,TP
paycent=usb(request("paycent"))
about=usb(request("about"))
num=usb(request("num"))
TP=usb(request("TP"))
	id=request("id")
	set rs=Sersaytkr.CreateObject("ADODB.Recordset")
	rs.open"select * from keep where uid="&myid&" and lx=0 and Amount>0 and id="&id,Giftsconn,1,2
	if rs.eof then
	Response.write "没有该礼物<br/>"
	else
if tp="" then
	Response.Write "<img src='"&rs("url")&"' alt='..'/><br/>"&rs("nane")&"<br/>简介:"&rs("txta")&"<br/>----------<br/>"
	if mxjy=2 then
response.write "<form action=""index.asp?info=b&amp;saytk="&saytk&"&amp;sid="&sid&""" method=""post"" accept-charset=""UTF-8"">"
	end if
	if Session("QYCID")<>"" then
	Response.write "赠送给<a href=""/bbs/uinfo.asp?id="&Session("QYCID")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&myname(Session("QYCID"))&"</a>ID:"&Session("QYCID")&"<br/>"
	else
	Response.write "赠送给(ID):<input name=""paycent"" emptyok=""true"" format=""*N"" size=""6"" value=""0""/><br/>"
	end if
	Response.write "附上几句温馨的话语吧:<br/><input name=""about"" maxlength=""30"" emptyok=""true""/><br/>"
	Response.write "想如何赠送呢?<br/>"
	Response.write "<select name=""num"" value=""1"">"
	Response.write "<option value=""1"">公开赠送</option>"
	Response.write "<option value=""2"">悄悄赠送</option>"
	Response.write "<option value=""3"">匿名赠送</option>"
	Response.write "</select><br/>"
		if mxjy=2 then
	Response.write "<input type='hidden'  name='TP' value='ok'/>"
	Response.write "<input type='hidden'  name='id' value='"&rs("id")&"'/>"
	Response.write "<input type=""submit"" value=""OK!决定了""/></form><br/>"
		else
	response.write "<anchor>OK!决定了"
	response.write "<go href=""index.asp?info=b&amp;saytk="&saytk&"&amp;sid="&sid&""" method=""post"" accept-charset=""utf-8"">"
	if Session("QYCID")="" then
	response.write "<postfield name=""paycent"" value=""$(paycent)""/>"
	end if
	response.write "<postfield name=""about"" value=""$(about)""/>"
	response.write "<postfield name=""num"" value=""$(num)""/>"
	response.write "<postfield name=""TP"" value=""ok""/>"
	response.write "<postfield name=""id"" value="""&rs("id")&"""/>"
	response.write "</go></anchor><br/>"
		end if
else
			if Session("QYCID")="" then
			if paycent="" or Isnumeric(paycent)=False then
			Call Error("ID无效！")
			end if
			else
			paycent=Session("QYCID")
			end if
			if int(paycent)=int(myid) then
			Call Error("人缘不好，要自己送礼物给自己啊！")
			end if
			if about="" then
			Call Error("请正确填写，各项都不能为空！")
			end if
			if num="" or Isnumeric(num)=False then
			Call Error("赠送选择无效！")
			end if
			set rs1=Sersaytkr.CreateObject("ADODB.Recordset")
			rs1.open"select * from [Users] where [id]="&paycent,conn,1,1
			if rs1.eof then
			Call Error("没有此会员！")
			end if
			rs1.close
			set rs1=nothing 
	'conn.execute("update Users set myjb=myjb-"&abs(int(Pri))&" where ID="&myid)
	set rs1=Sersaytkr.CreateObject("ADODB.Recordset")
	rs1.open "select * from keep where uid="&paycent&" and lx=1 and url='"&rs("url")&"'",Giftsconn,1,2
	if rs1.eof then
	rs1.addnew
	rs1("uid")=paycent
	rs1("nane")=rs("nane")
	rs1("url")=rs("url")
	rs1("txta")=rs("txta")
	rs1("Amount")=1
	rs1("lx")=1
	else
	rs1("Amount")=rs1("Amount")+1
	end if
	rs1.update
	rs("Amount")=rs("Amount")-1 '更新数量
	rs.update
	if rs("Amount")<=0 then 
	Giftsconn.execute("delete from keep where ID="&id)
	end if
	rs1.close
	set rs1=nothing 
	conn.execute("update Users set myjy=myjy+"&abs(int(GiftsSend))&" where ID="&myid)
	conn.execute("update Users set myjy=myjy+"&abs(int(GiftsClosea))&" where ID="&paycent)
	response.write "赠送成功<br/>TA经验加"&GiftsClosea&",您经验加"&GiftsSend&"<br/>"
	
	set rs2=Sersaytkr.CreateObject("ADODB.Recordset")
	rs2.open "select * from Record1 where uid="&paycent, Giftsconn,1,2
	if rs2.eof then
	rs2.addnew
	rs2("Closea")=1
	rs2("uid")=paycent
	else
	rs2("Closea")=rs2("Closea")+1
	end if
	rs2.update
	rs2.close
	set rs2=nothing
	set rs2=Sersaytkr.CreateObject("ADODB.Recordset")
	rs2.open "select * from Record1 where uid="&myid, Giftsconn,1,2
	if rs2.eof then
	rs2.addnew
	rs2("Send")=1
	rs2("uid")=myid
	else
	rs2("Send")=rs2("Send")+1
	end if
	rs2.update
	rs2.close
	set rs2=nothing
	if num=1 then
	set rs2=Sersaytkr.CreateObject("ADODB.Recordset")
	rs2.open "select * from Record ", Giftsconn,1,2
	rs2.addnew
	rs2("uid")=myid
	rs2("ids")=paycent
	rs2("nane")=rs("nane")
	rs2.update
	rs2.close
	set rs2=nothing
	end if

	dim msgx
	msgx = about
	msgx = msgx & "\\(img)/bbs/Gifts/"&rs("url")&"(/img)"
	msgx = msgx & "\\给您送礼来了，快到收礼箱(url=/bbs/Gifts/index.asp?info=c&ino=e&sid=[sid])查收(/url)吧!"
	set rsx=Sersaytkr.CreateObject("ADODB.Recordset")
	rsx.open"select * from [guest]",conn,1,2
	rsx.addnew
	rsx("sid")=paycent
	if num=3 then
	rsx("fid")=0
	else
	rsx("fid")=myid
	end if
	rsx("fnr")=msgx
	rsx("tou")=1
	rsx.update
	rsx.close
	set rsx=Nothing
	
end if

	end if
	rs.close
	set rs=nothing 
response.write "<a href=""index.asp?info=c&amp;ino=d&amp;saytk="&saytk&"&amp;sid="&sid&""">返回我的储物箱</a><br/>"
end sub

sub c()
lxid=request("lxid")
QYCID=request("id")
if QYCID<>"" then Session("QYCID") = QYCID

if ino="a" then 
	mife="select * from txt where Amount>0 order by Amount1 desc"
	gopage="index.asp?info=c&amp;ino=a&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;"
	msg="暂时没有记录...<br/>"
elseif ino="b" then
	mife="select * from txt where Amount>0 order by id desc"
	gopage="index.asp?info=c&amp;ino=b&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;"
	msg="暂时没有记录...<br/>"
elseif ino="c" then
		if lxid="" then
		mife="select * from txt where Amount>0 order by id desc"
		gopage="index.asp?info=c&amp;ino=c&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;"
		msg="暂时没有记录...<br/>"
		else
		mife="select * from txt where Amount>0 and Categories="&lxid&" order by id desc"
		gopage="index.asp?info=c&amp;ino=c&amp;lxid="&lxid&"&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;"
		msg="暂时没有记录...<br/>"
		end if
	
	
	mdfk=Giftsconn.execute("Select count(ID) from lx ")(0)
	set rs=Sersaytkr.CreateObject("ADODB.Recordset")
	rs.open"select * from lx ",Giftsconn,1,1
	for ii=1 to mdfk
	if rs("id")=clng(lxid) then 
	response.write rs("nane")&"|"
	else
	response.write "<a href=""index.asp?lxid="&rs("id")&"&amp;info=c&amp;ino=c&amp;saytk="&saytk&"&amp;sid="&sid&""">"&rs("nane")&"</a>|"
	end if
	rs.Mosaytknext
	if rs.EOF then Exit for 
	next 
	if lxid="" then
	response.write "全部<br/>"
	else
	response.write "<a href=""index.asp?info=c&amp;ino=c&amp;saytk="&saytk&"&amp;sid="&sid&""">全部</a><br/>"
	end if
	rs.close
	set rs=nothing 
elseif ino="d" then
	mife="select * from keep where lx=0 and uid="&myid&" order by id desc"
	gopage="index.asp?info=c&amp;ino=d&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;"
	msg="箱子里积了厚厚的灰尘,快买几件礼物丰富一下自己的储物箱吧!<br />"
elseif ino="e" then
	mife="select * from keep where lx=1 and uid="&myid&" order by id desc"
	gopage="index.asp?info=c&amp;ino=e&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;"
	msg="您还没有收到任何礼物呦!主动一些,先给您的好友送上一份<a href=""index.asp?info=c&amp;ino=d&amp;saytk="&saytk&"&amp;sid="&sid&""">精美的礼物</a>吧!<br/>"
elseif ino="f" then
	mife="select * from Record order by time desc"
	gopage="index.asp?info=c&amp;ino=f&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;"
	msg="还没有任何动作记录！<br/>"
elseif ino="g" then
	mife="select * from Record where uid="&myid&" order by time desc"
	gopage="index.asp?info=c&amp;ino=g&amp;saytk="&saytk&"&amp;sid="&sid&"&amp;"
	msg="还没有任何记录！<br/>"
end if
'''''''''''
if ino="d" then response.write"待送礼物|<a href=""index.asp?info=c&amp;ino=g&amp;saytk="&saytk&"&amp;sid="&sid&""">送礼清单</a><br/>您目前拥有"&Counts&"件礼物<br/>--------<br/>"
if ino="g" then response.write"<a href=""index.asp?info=c&amp;ino=d&amp;saytk="&saytk&"&amp;sid="&sid&""">待送礼物</a>|送礼清单<br/>您目前拥有"&Counts&"件礼物<br/>--------<br/>"
if ino="e" then response.write"共收到"&Counts1&"件礼物<br/>每份礼物都是温馨的祝福哦!<br/>--------<br/>"
set rs1=Sersaytkr.CreateObject("ADODB.Recordset")
rs1.open mife,Giftsconn,1,1
if rs1.eof then    
response.write msg
		if ino="d" or ino="e" then
		Randomize 
		Set RS = Giftsconn.Execute("Select TOP 1 * FROM txt orDER BY rnd(-(id +" & rnd() & "))") 
		Do While Not RS.EOF 
		url=RS.Fields("url").value 
		nane=RS.Fields("nane").value 
		Amount=RS.Fields("Amount").value
		Amount1=RS.Fields("Amount1").value
		txta=RS.Fields("txta").value
		Price=RS.Fields("Price").value
		idd=RS.Fields("id").value
		RS.MosaytkNext 
		Loop 
		RS.Close 
		Set RS = Nothing 
		Giftsconn.Close 
		Set Giftsconn = Nothing
		
		Response.Write "<img src='"&url&"' alt='..'/><br/><a href=""index.asp?info=d&amp;id="&idd&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&nane&"</a>(今日仅剩"&Amount&"个)<br/>简介:"&txta&"<br/>价格"&Price&getcent&"<br/>--已有"&Amount1&"人购买该礼物--<br/>"
		end if
else

 Dim PageSize,i
	PageSize=5
	Dim Count,page,pagecount,gopage			
	Count=rs1.recordcount	
	page=int(request.QueryString ("page"))
	if page<=0 or page="" then page=1		
	pagecount=(count+pagesize-1)\pagesize	
        if page>pagecount then page=pagecount
	rs1.mosaytk(pagesize*(page-1))
	For i=1 To PageSize     						
	If rs1.eof Then Exit For
if ino="d" then
response.write "<img src='"&rs1("url")&"' alt='..'/><br/>"&rs1("nane")&"("&rs1("Amount")&"件)<br/>简介:"&rs1("txta")&"<br/>[<a href=""index.asp?info=b&amp;id="&rs1("id")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">赠送</a>/<a href=""index.asp?info=e&amp;id="&rs1("id")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">删除</a>]<br/>-----------<br/>"
elseif ino="e" then
response.write "<img src='"&rs1("url")&"' alt='..'/><br/>"&rs1("nane")&"("&rs1("Amount")&"件)<br/>简介:"&rs1("txta")&"<br/>[<a href=""index.asp?info=e&amp;id="&rs1("id")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">删除</a>]<br/>-----------<br/>"
elseif ino="f" then
response.write  date_gametalk(rs1("time"))&"前>><a href=""/bbs/uinfo.asp?id="&rs1("uid")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&myname(rs1("uid"))&"</a>给<a href=""/bbs/uinfo.asp?id="&rs1("ids")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&myname(rs1("ids"))&"</a>送了一个"&rs1("nane")&"<br/>----------<br/>"
elseif ino="g" then
response.write  date_gametalk(rs1("time"))&"前>>您给<a href=""/bbs/uinfo.asp?id="&rs1("ids")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&myname(rs1("ids"))&"</a>送了一个"&rs1("nane")&"<br/>----------<br/>"
else
response.write "<img src='"&rs1("url")&"' alt='..'/><br/><a href=""index.asp?info=d&amp;id="&rs1("id")&"&amp;saytk="&saytk&"&amp;sid="&sid&""">"&rs1("nane")&"</a><br/>简介:"&rs1("txta")&"<br/>价格:"&rs1("Price")&getcent&"<br/>--该礼物已卖出"&rs1("Amount1")&"件--<br/>----------<br/>"
end if
	rs1.mosaytkNext
 	Next
	if page-pagecount<0 then response.write "<a href="""&gopage&"page="&page+1&""">下一页</a>"&chr(13)
	if page>1 then response.write "<a href="""&gopage&"page="&page-1&""">上一页</a>"&chr(13)
if pagecount>1 then response.write"<br/>"
	end if
rs1.close
set rs1=nothing  
Response.write "<a href=""index.asp?info=c&amp;ino=c&amp;saytk="&saytk&"&amp;sid="&sid&""">〓进入礼物大厅〓</a><br/>"
if ino="a" then
response.write "热销礼物|<a href=""index.asp?info=c&amp;ino=b&amp;saytk="&saytk&"&amp;sid="&sid&""">新品上架</a><br/>"
elseif ino="b" then
response.write "<a href=""index.asp?info=c&amp;ino=a&amp;saytk="&saytk&"&amp;sid="&sid&""">热销礼物</a>|新品上架<br/>"
else
response.write "<a href=""index.asp?info=c&amp;ino=a&amp;saytk="&saytk&"&amp;sid="&sid&""">热销礼物</a>|<a href=""index.asp?info=c&amp;ino=b&amp;saytk="&saytk&"&amp;sid="&sid&""">新品上架</a><br/>"
end if
end sub

sub d()
id=request("id")
act=request("act")
set rs=Sersaytkr.CreateObject("ADODB.Recordset")
rs.open "select * from txt where Amount>0 and id="&id,Giftsconn,1,2
if rs.eof then       
response.write"暂时没有记录...<br/>"
else
if act="" then
	response.write "<img src='"&rs("url")&"' alt='..'/><br/>"
	response.write rs("nane")&"<br/>--------<br/>"
	response.write "简介:"&rs("txta")&"<br/>"
	response.write "--已有"&rs("Amount1")&"人购买此礼物--<br/>--------<br/>"
	response.write "您目前共有"&myjb&getcent&"<br/>"
	response.write "【单件购买】<br/>价格:"&rs("Price")&getcent&"<br/>"
	response.write "==<a href=""index.asp?info=d&amp;id="&rs("id")&"&amp;act=a&amp;saytk="&saytk&"&amp;sid="&sid&""">购买该礼物</a>==<br/>"
	response.write "【批发价购买】<br/>"
		if rs("Amount")>=5 then
		response.write "<a href=""index.asp?info=d&amp;id="&rs("id")&"&amp;act=b&amp;saytk="&saytk&"&amp;sid="&sid&""">买5件>></a><br/>"
		Price=rs("Price")*5
		response.write "打9折哦,共"&Price*0.9&getcent&"<br/>"
		end if
		if rs("Amount")>=10 then
		response.write "<a href=""index.asp?info=d&amp;id="&rs("id")&"&amp;act=c&amp;saytk="&saytk&"&amp;sid="&sid&""">买10件>></a><br/>"
		Price1=rs("Price")*10
		response.write "打8折哦,共"&Price1*0.8&getcent&"<br/>"
		end if
else
	if clng(myjb)<rs("Price") then
	call error(""&getcent&"不足！")
	end if
	if act="a" then
	Pri=int(rs("Price"))
	Pri1=1
	elseif act="b" then
	Pri=int(rs("Price")*5*0.9)
	Pri1=5
	elseif act="c" then
	Pri=int(rs("Price")*10*0.8)
	Pri1=10
	end if
	conn.execute("update Users set myjb=myjb-"&abs(int(Pri))&" where ID="&myid)
	set rs1=Sersaytkr.CreateObject("ADODB.Recordset")
	rs1.open "select * from keep where uid="&myid&" and lx=0 and url='"&rs("url")&"'",Giftsconn,1,2
	if rs1.eof then
	rs1.addnew
	rs1("uid")=myid
	rs1("nane")=rs("nane")
	rs1("url")=rs("url")
	rs1("txta")=rs("txta")
	rs1("Amount")=Pri1
	else
	rs1("Amount")=rs1("Amount")+Pri1
	end if
	rs1.update
	rs("Amount")=rs("Amount")-Pri1 '更新数量
	rs("Amount1")=rs("Amount1")+Pri1 '更新买出数量
	rs.update
	rs1.close
	set rs1=nothing 
	response.write "购买成功<a href=""index.asp?info=c&amp;ino=c&amp;saytk="&saytk&"&amp;sid="&sid&""">返回礼物大厅</a><br/>"

end if
end if
rs.close
set rs=nothing  
end sub

sub e()
id=request("id")
Giftsconn.execute("delete from keep where ID="&id)
response.write "成功删除<a href=""index.asp?info=c&amp;ino=d&amp;saytk="&saytk&"&amp;sid="&sid&""">返回</a><br/>"
end sub
Giftsconn.close
set Giftsconn=nothing
conn.close
set conn=nothing
response.write"----------"
if KEYS=1 then
response.write"<br/><a href=""admin.asp?saytk="&saytk&"&amp;sid="&sid&""">站长管理</a>"
end if
%><!--#include file="fanhui.asp"-->
<%call head1()%>