<!--#include file="Inc.asp"-->
<!-- #include file=pet_conn.asp -->
<%
If Not BBS94KK.Founduser Then BBS94KK.GoToErr(10)
BBS94KK.Head("宠物宝贝 → 装备买卖市场")
    dim  money,smoney,saveday,allmoney,time1,time2,daikuang,dkdu,daiday,sucmsg
    dim Form_userphoto,Form_FaceUrl,Form_FaceWidth,Form_FaceHeight,action,item1,item2,item3,item4,item5
    
   Dim Rs,SQL

	set rs=bbs94kk.execute("select * from [kk_User] where  name='"&bbs94kk.myname &"'")
      	
    money=rs("coin")
    Form_userphoto = Rs("pic")
	DEF_PointsName="金币"

		Form_FaceWidth = Rs("picW")
		Form_FaceHeight = Rs("picH")
    rs.close 
    

    sql = "SELECT * FROM mypetdata WHERE username='"&bbs94kk.myname&"' "
    rs.open sql,connpet,1,3
    if rs.eof then
'call showmessage("你还没有宠物啊，快攒钱去买吧~","petshop.asp")
Response.Write "<script language=JavaScript>{alert('你还没有宠物啊，快攒钱去买吧！');(location.href = 'petshop.asp')}</script>"
        else

item1=0
item2=0
item3=0
item4=0
item5=0

if rs("item1")<>0 then item1=1 end if
if rs("item2")<>0 then item2=1 end if
if rs("item3")<>0 then item3=1 end if
if rs("item4")<>0 then item4=1 end if
if rs("item5")<>0 then item5=1 end if




dim tmoney,sword,tmp,necklace,head,body,foot,rndNum
		
if request("action") = ""  or request("action")="showsword" then
	action = "marketroom"
	else
	action = lcase(request("action"))
end if



'注册宠物物品箱中物品

Dim Rs2,SQL2,hpitem,spitem,expitem,liveitem,weopitem,amoritem,jewel,ring,it1,it1n,it2,it2n,it3,it3n,it4,it4n,it5,it5n,it6,it6n,it7,it7n,it8,it8n
dim tempname,tempclass,tempNum,tempN,it,temp

sql2 = "SELECT * FROM useritem WHERE username='"&bbs94kk.myname&"' "
set rs2=connpet.ExeCute(sql2)
hpitem=rs2("hpitem")
spitem=rs2("spitem")
expitem=rs2("expitem")
'atkitem=rs2("atkitem")
'defitem=rs2("defitem")
liveitem=rs2("liveitem")	
weopitem=rs2("weopitem")
amoritem=rs2("amoritem")
jewel=rs2("jewel")
ring=rs2("ring")
it1=rs2("it1")
it1n=rs2("it1n")
it2=rs2("it2")
it2n=rs2("it2n")
it3=rs2("it3")
it3n=rs2("it3n")
it4=rs2("it3")
it4n=rs2("it4n")
it5=rs2("it5")
it5n=rs2("it5n")
it6=rs2("it6")
it6n=rs2("it6n")
it7=rs2("it7")
it7n=rs2("it7n")
it8=rs2("it8")
it8n=rs2("it8n")




select case action
	case "sell"				'卖东西啊
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if			
		dim itemmoney,itemN,itemNum,itemuesr,itemclass,itemName
		itemmoney = request("itemmoney")
		itemN = cint(request("itemn"))
		itemNum = Clng(request("itemNum"))
		itemuesr = bbs94kk.myname
		itemclass = request("itemclass")
		itemName = request("itemName")
		
		'统计用户待出售物品个数
		Dim Rs4,SQL4,kkk
		sql4 = "SELECT COUNT(id) FROM itemmarket WHERE itemuesr='"&bbs94kk.myname&"' "
		set rs4=connpet.ExeCute(sql4)
		kkk=rs4(0)
		rs4.close
		
		if kkk>10 then
'call showmessage("您待出售的物品已经超过10个，请酌情出售您的物品！","petitemmarket.asp")
Response.Write "<script language=JavaScript>{alert('您待出售的物品已经超过10个，请酌情出售您的物品！');(location.href = 'petitemmarket.asp')}</script>"
		end if
		
		
		set rs = connpet.execute("select * from mypetdata where username='"&bbs94kk.myname&"'")
'补丁，防刷装备
		select case itemclass
			case "sword"
				if item1=0 then 
'call showmessage("刷装备者，杀无赦！","petitemmarket.asp?action=givesell")
Response.Write "<script language=JavaScript>{alert('刷装备者，杀无赦！');(location.href = 'petitemmarket.asp?action=givesell')}</script>"
end if
			case "necklace"
				if item2=0 then 
'call showmessage("刷装备者，杀无赦！","petitemmarket.asp?action=givesell") 
Response.Write "<script language=JavaScript>{alert('刷装备者，杀无赦！');(location.href = 'petitemmarket.asp?action=givesell')}</script>"
end if
			case "head"
				if item3=0 then 
'call showmessage("刷装备者，杀无赦！","petitemmarket.asp?action=givesell") 
Response.Write "<script language=JavaScript>{alert('刷装备者，杀无赦！');(location.href = 'petitemmarket.asp?action=givesell')}</script>"
end if	
			case "body"
				if item4=0 then 
'call showmessage("刷装备者，杀无赦！","petitemmarket.asp?action=givesell") 
Response.Write "<script language=JavaScript>{alert('刷装备者，杀无赦！');(location.href = 'petitemmarket.asp?action=givesell')}</script>"
end if		
			case "foot"
				if item5=0 then 
'call showmessage("刷装备者，杀无赦！","petitemmarket.asp?action=givesell") 
Response.Write "<script language=JavaScript>{alert('刷装备者，杀无赦！');(location.href = 'petitemmarket.asp?action=givesell')}</script>"
end if		
		
		
		end select

		
		
		
		
		
		if not isnumeric(itemmoney) then
'call showmessage("价钱必须是数字！","petitemmarket.asp?action=givesell")
Response.Write "<script language=JavaScript>{alert('价钱必须是数字！');(location.href = 'petitemmarket.asp?action=givesell')}</script>"
		elseif clng(itemmoney)<1 then
'call showmessage("赔本的生意啊？没毛病吧？！","petitemmarket.asp?action=givesell")
Response.Write "<script language=JavaScript>{alert('赔本的生意啊？没毛病吧？！');(location.href = 'petitemmarket.asp?action=givesell')}</script>"
		elseif not isnumeric(itemNum) then
'call showmessage("数量必须是数字！","petitemmarket.asp?action=givesell")
Response.Write "<script language=JavaScript>{alert('数量必须是数字！');(location.href = 'petitemmarket.asp?action=givesell')}</script>"
		elseif clng(itemNum)<1 then
			if itemclass="update" then
'call showmessage("一个都不卖，扰乱市场持续？","petitemmarket.asp?action=givesell")
Response.Write "<script language=JavaScript>{alert('一个都不卖，扰乱市场持续？');(location.href = 'petitemmarket.asp?action=givesell')}</script>"
			else
'call showmessage("0级装备不能卖出！","petitemmarket.asp?action=givesell")
Response.Write "<script language=JavaScript>{alert('级装备不能卖出！');(location.href = 'petitemmarket.asp?action=givesell')}</script>"
			end if
		elseif itemclass="update" and ((itemn=0 and rs2("weopitem")<itemnum) or (itemn=1 and rs2("amoritem")<itemnum)) then
'call showmessage("你没有那么多东西卖啊","petitemmarket.asp?action=givesell")
Response.Write "<script language=JavaScript>{alert('你没有那么多东西卖啊！');(location.href = 'petitemmarket.asp?action=givesell')}</script>"
		else
			
			sql = "INSERT INTO [itemmarket] (itemname, itemMoney, itemNum, itemUesr, ItemClass, ItemN) VALUES ('"&itemname&"', "&itemMoney&", "&itemNum&", '"&bbs94kk.myname&"', '"&ItemClass&"', "&ItemN&")"
			connpet.execute(SQL)
			'response.write SQL
			
			select case itemclass
				case "sword"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
					connpet.execute("update [mypetdata] set item1=0,item1num=0 where username='"&bbs94kk.myname&"'")
'call showmessage("您的 "&itemName&" （+"&itemNum&"）已卖出，等人购买！售价 "&itemMoney&" 元！","petitemmarket.asp?action=show"&itemclass)
Response.Write "<script language=JavaScript>{alert('您的 "&itemName&" （+"&itemNum&"）已卖出，等人购买！售价 "&itemMoney&" 元！');(location.href = 'petitemmarket.asp?action=show"&itemclass&"')}</script>"
					
				case "necklace"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
					connpet.execute("update [mypetdata] set item2=0,item2num=0 where username='"&bbs94kk.myname&"'")
'call showmessage("您的 "&itemName&" （+"&itemNum&"）已卖出，等人购买！售价 "&itemMoney&" 元！","petitemmarket.asp?action=show"&itemclass)
Response.Write "<script language=JavaScript>{alert('您的 "&itemName&" （+"&itemNum&"）已卖出，等人购买！售价 "&itemMoney&" 元！');(location.href = 'petitemmarket.asp?action=show"&itemclass&"')}</script>"

				case "head"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
					connpet.execute("update [mypetdata] set item3=0,item3num=0 where username='"&bbs94kk.myname&"'")
'call showmessage("您的 "&itemName&" （+"&itemNum&"）已卖出，等人购买！售价 "&itemMoney&" 元！","petitemmarket.asp?action=show"&itemclass)
Response.Write "<script language=JavaScript>{alert('您的 "&itemName&" （+"&itemNum&"）已卖出，等人购买！售价 "&itemMoney&" 元！');(location.href = 'petitemmarket.asp?action=show"&itemclass&"')}</script>"

				case "body"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
					connpet.execute("update [mypetdata] set item4=0,item4num=0 where username='"&bbs94kk.myname&"'")
'call showmessage("您的 "&itemName&" （+"&itemNum&"）已卖出，等人购买！售价 "&itemMoney&" 元！","petitemmarket.asp?action=show"&itemclass)
Response.Write "<script language=JavaScript>{alert('您的 "&itemName&" （+"&itemNum&"）已卖出，等人购买！售价 "&itemMoney&" 元！');(location.href = 'petitemmarket.asp?action=show"&itemclass&"')}</script>"

				case "foot"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
					connpet.execute("update [mypetdata] set item5=0,item5num=0 where username='"&bbs94kk.myname&"'")
'call showmessage("您的 "&itemName&" （+"&itemNum&"）已卖出，等人购买！售价 "&itemMoney&" 元！","petitemmarket.asp?action=show"&itemclass)
Response.Write "<script language=JavaScript>{alert('您的 "&itemName&" （+"&itemNum&"）已卖出，等人购买！售价 "&itemMoney&" 元！');(location.href = 'petitemmarket.asp?action=show"&itemclass&"')}</script>"

				case "update"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
					if itemN=0 then
						connpet.execute("update [useritem] set weopitem=weopitem-"&itemnum&" where username='"&bbs94kk.myname&"'")
'call showmessage("您的 "&itemName&" （"&itemNum&"个）已卖出，等人购买！售价 "&itemMoney&" 元！","petitemmarket.asp?action=show"&itemclass)
Response.Write "<script language=JavaScript>{alert('您的 "&itemName&" （"&itemNum&"个）已卖出，等人购买！售价 "&itemMoney&" 元！');(location.href = 'petitemmarket.asp?action=show"&itemclass&"')}</script>"
					else
						connpet.execute("update [useritem] set amoritem=amoritem-"&itemnum&" where username='"&bbs94kk.myname&"'")
'call showmessage("您的 "&itemName&" （"&itemNum&"个）已卖出，等人购买！售价 "&itemMoney&" 元！","petitemmarket.asp?action=show"&itemclass)
Response.Write "<script language=JavaScript>{alert('您的 "&itemName&" （"&itemNum&"个）已卖出，等人购买！售价 "&itemMoney&" 元！');(location.href = 'petitemmarket.asp?action=show"&itemclass&"')}</script>"
					end if
			end select
		end if
		rs.close
	case "buy"				'买东西啊~~
	

http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
		
		dim buyid,rsbuy
		buyid=cint(request("id"))
		
		set rs = connpet.execute("select * from [itemmarket] where id="&buyid)
		if rs.eof and rs.bof then call showmessage("查无此物，或已经卖出！","petitemmarket.asp?action=show"&request("itemclass"))
		if rs("itemuesr")= bbs94kk.myname then call showmessage("此货物原本就是你的，你无法购买！","petitemmarket.asp?action=show"&request("itemclass"))
		if money < rs("itemmoney") then call showmessage("你的钱不够，凑齐了再来买！","petitemmarket.asp?action=show"&request("itemclass"))
		select case request("itemclass")
			case "sword"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
						if item1<>0 then
						call showmessage("你的身上装备了同类型物品<br>请卸下身上的物品后重新购买","petitemmarket.asp")
						else
				connpet.execute("update [mypetdata] set item1="&cint(rs("itemn"))&",item1num="&clng(rs("itemNum"))&" where username='"&bbs94kk.myname&"'")
				bbs94kk.execute("update [kk_User] set coin=coin-"&clng(rs("itemmoney"))&" where name='"&bbs94kk.myname&"'")
Session(CacheName & "MyInfo") = Empty
				bbs94kk.execute("update [kk_User] set coin=coin+"&clng(rs("itemmoney"))&" where name='"&rs("itemuesr")&"'")
                                
				
				connpet.execute("DELETE from [itemmarket] where id="&buyid)
				Call showmessage("恭喜您购得了"&request("itemname")&"！","petitemmarket.asp")

						end if
			case "necklace"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
									if item2<>0 then
						call showmessage("你的身上装备了同类型物品<br>请卸下身上的物品后重新购买","petitemmarket.asp")
						else
				connpet.execute("update [mypetdata] set item2="&cint(rs("itemn"))&",item2num="&clng(rs("itemNum"))&" where username='"&bbs94kk.myname&"'")
				bbs94kk.execute("update [kk_User] set coin=coin-"&clng(rs("itemmoney"))&" where name='"&bbs94kk.myname&"'")
Session(CacheName & "MyInfo") = Empty
				'Call UpdateUserInfo(-clng(rs("itemmoney")),0,0,0,0,0)	'道具Bug修正啦~ 绿光光	 2005-4-8
				bbs94kk.execute("update [kk_User] set coin=coin+"&clng(rs("itemmoney"))&" where name='"&rs("itemuesr")&"'")
				

				connpet.execute("DELETE from [itemmarket] where id="&buyid)
				'Call UpdateUserInfo(-clng(rs("itemmoney")),0,0,0,0,0)
				call showmessage("恭喜您购得了"&request("itemname")&"！","petitemmarket.asp")

				end if
			case "head"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
									if item3<>0 then
						call showmessage("你的身上装备了同类型物品<br>请卸下身上的物品后重新购买","petitemmarket.asp")
						else
				connpet.execute("update [mypetdata] set item3="&cint(rs("itemn"))&",item3num="&clng(rs("itemNum"))&" where username='"&bbs94kk.myname&"'")
				bbs94kk.execute("update [kk_User] set coin=coin-"&clng(rs("itemmoney"))&" where name='"&bbs94kk.myname&"'")
Session(CacheName & "MyInfo") = Empty
				'Call UpdateUserInfo(-clng(rs("itemmoney")),0,0,0,0,0)	'道具Bug修正啦~ 绿光光	 2005-4-8
				bbs94kk.execute("update [kk_User] set coin=coin+"&clng(rs("itemmoney"))&" where name='"&rs("itemuesr")&"'")
				bb

				connpet.execute("DELETE from [itemmarket] where id="&buyid)
				call showmessage("恭喜您购得了"&request("itemname")&"！","petitemmarket.asp")

				end if
			case "body"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
									if item4<>0 then
						call showmessage("你的身上装备了同类型物品<br>请卸下身上的物品后重新购买","petitemmarket.asp")
						else
				connpet.execute("update [mypetdata] set item4="&cint(rs("itemn"))&",item4num="&clng(rs("itemNum"))&" where username='"&bbs94kk.myname&"'")
				bbs94kk.execute("update [kk_User] set coin=coin-"&clng(rs("itemmoney"))&" where name='"&bbs94kk.myname&"'")
Session(CacheName & "MyInfo") = Empty
				'Call UpdateUserInfo(-clng(rs("itemmoney")),0,0,0,0,0)	'道具Bug修正啦~ 绿光光	 2005-4-8
				bbs94kk.execute("update [kk_User] set coin=coin+"&clng(rs("itemmoney"))&" where name='"&rs("itemuesr")&"'")
				

				connpet.execute("DELETE from [itemmarket] where id="&buyid)
				call showmessage("恭喜您购得了"&request("itemname")&"！","petitemmarket.asp")

				end if
			case "foot"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
									if item5<>0 then
						call showmessage("你的身上装备了同类型物品<br>请卸下身上的物品后重新购买","petitemmarket.asp")
						else
				connpet.execute("update [mypetdata] set item5="&cint(rs("itemn"))&",item5num="&clng(rs("itemNum"))&" where username='"&bbs94kk.myname&"'")
				bbs94kk.execute("update [kk_User] set coin=coin-"&clng(rs("itemmoney"))&" where name='"&bbs94kk.myname&"'")
Session(CacheName & "MyInfo") = Empty
				'Call UpdateUserInfo(-clng(rs("itemmoney")),0,0,0,0,0)	'道具Bug修正啦~ 绿光光	 2005-4-8
				bbs94kk.execute("update [kk_User] set coin=coin+"&clng(rs("itemmoney"))&" where name='"&rs("itemuesr")&"'")
				

				connpet.execute("DELETE from [itemmarket] where id="&buyid)
				call showmessage("恭喜您购得了"&request("itemname")&"！","petitemmarket.asp")

				end if
			case "update"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
				if request("itemN")=0 then
					connpet.execute("update [useritem] set weopitem=weopitem+"&cint(rs("itemnum"))&" where username='"&bbs94kk.myname&"'")
					bbs94kk.execute("update [kk_User] set coin=coin-"&clng(rs("itemmoney"))&" where name='"&bbs94kk.myname&"'")
Session(CacheName & "MyInfo") = Empty
					'Call UpdateUserInfo(-clng(rs("itemmoney")),0,0,0,0,0)	'道具Bug修正啦~ 绿光光	 2005-4-8
					bbs94kk.execute("update [kk_User] set coin=coin+"&clng(rs("itemmoney"))&" where name='"&rs("itemuesr")&"'")
					

					connpet.execute("DELETE from [itemmarket] where id="&buyid)
					call showmessage("恭喜您购得了"&request("itemname")&"！","petitemmarket.asp")

				else
					connpet.execute("update [useritem] set amoritem=amoritem+"&cint(rs("itemnum"))&" where name='"&bbs94kk.myname&"'")
					bbs94kk.execute("update [kk_User] set coin=coin-"&clng(rs("itemmoney"))&" where name='"&bbs94kk.myname&"'")
Session(CacheName & "MyInfo") = Empty
					'Call UpdateUserInfo(-clng(rs("itemmoney")),0,0,0,0,0)	'道具Bug修正啦~ 绿光光	 2005-4-8
					bbs94kk.execute("update [kk_User] set coin=coin+"&clng(rs("itemmoney"))&" where name='"&rs("itemuesr")&"'")
					
					connpet.execute("DELETE from [itemmarket] where id="&buyid)
					call showmessage("恭喜您购得了"&request("itemname")&"！","petitemmarket.asp")

				end if			
		end select		
	case "nosell"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
		dim nosellid
		nosellid=cint(request("id"))
		set rs = connpet.execute("select * from [itemmarket] where id="&nosellid)
		if rs.eof and rs.bof then call showmessage("查无此物，或已经卖出！","petitemmarket.asp?action=show"&request("itemclass"))
		if rs("itemuesr")<> bbs94kk.myname then call showmessage("此货物原本不是你的，你无法取消销售！","petitemmarket.asp?action=show"&request("itemclass"))
		select case request("itemclass")
			case "sword"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
						if item1<>0 then
						call showmessage("你的身上装备了同类型物品<br>请卸下身上的物品后重新取回","petitemmarket.asp")
						else
				connpet.execute("update [mypetdata] set item1="&cint(rs("itemn"))&",item1num="&clng(rs("itemNum"))&" where username='"&bbs94kk.myname&"'")
				connpet.execute("DELETE from [itemmarket] where id="&nosellid)
				call showmessage("您的物品 "&request("itemname")&" 回到了您手中！","petitemmarket.asp")
				end if
			case "necklace"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
						if item2<>0 then
						call showmessage("你的身上装备了同类型物品<br>请卸下身上的物品后重新取回","petitemmarket.asp")
						else
				connpet.execute("update [mypetdata] set item2="&cint(rs("itemn"))&",item2num="&clng(rs("itemNum"))&" where username='"&bbs94kk.myname&"'")
				connpet.execute("DELETE from [itemmarket] where id="&nosellid)
				call showmessage("您的物品 "&request("itemname")&" 回到了您手中！","petitemmarket.asp")
				end if
			case "head"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
									if item3<>0 then
						call showmessage("你的身上装备了同类型物品<br>请卸下身上的物品后重新取回","petitemmarket.asp")
						else
				connpet.execute("update [mypetdata] set item3="&cint(rs("itemn"))&",item3num="&clng(rs("itemNum"))&" where username='"&bbs94kk.myname&"'")
				connpet.execute("DELETE from [itemmarket] where id="&nosellid)
				call showmessage("您的物品 "&request("itemname")&" 回到了您手中！","petitemmarket.asp")
				end if
			case "body"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
									if item4<>0 then
						call showmessage("你的身上装备了同类型物品<br>请卸下身上的物品后重新取回","petitemmarket.asp")
						else
				connpet.execute("update [mypetdata] set item4="&cint(rs("itemn"))&",item4num="&clng(rs("itemNum"))&" where username='"&bbs94kk.myname&"'")
				connpet.execute("DELETE from [itemmarket] where id="&nosellid)
				call showmessage("您的物品 "&request("itemname")&" 回到了您手中！","petitemmarket.asp")
				end if
			case "foot"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
									if item5<>0 then
						call showmessage("你的身上装备了同类型物品<br>请卸下身上的物品后重新取回","petitemmarket.asp")
						else
				connpet.execute("update [mypetdata] set item5="&cint(rs("itemn"))&",item5num="&clng(rs("itemNum"))&" where username='"&bbs94kk.myname&"'")
				connpet.execute("DELETE from [itemmarket] where id="&nosellid)
				call showmessage("您的物品 "&request("itemname")&" 回到了您手中！","petitemmarket.asp")
				end if
			case "update"
http = Request.ServerVariables("HTTP_REFERER")
If instr(http,"petitemmarket.asp")=0 Then
Response.Write "<script language=JavaScript>{alert('错误：请离开！！！！');(location.href = 'petitemmarket.asp')}</script>"
response.end
end if	
				if request("itemN")=0 then
					connpet.execute("update [useritem] set weopitem=weopitem+"&cint(rs("itemnum"))&" where username='"&bbs94kk.myname&"'")
					connpet.execute("DELETE from [itemmarket] where id="&nosellid)
					call showmessage("您的物品 "&request("itemname")&" 回到了您手中！","petitemmarket.asp")
				else
					connpet.execute("update [useritem] set amoritem=amoritem+"&cint(rs("itemnum"))&" where username='"&bbs94kk.myname&"'")
					connpet.execute("DELETE from [itemmarket] where id="&nosellid)
					call showmessage("您的物品 "&request("itemname")&" 回到了您手中！","petitemmarket.asp")
				end if			
		end select		
	
	end select
		rs.close
	end if
	

%>
<table width="760" border="0" cellspacing="1" cellpadding="5" align="center" class=TBone>
  <tr>
	<td class=tbbg1 valign=top>
	
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td width="28%" rowspan="2" valign=top><table width="79%"  border="0" align="center" cellpadding="3" cellspacing="3">
<tr><td width="100%"><div align="center">我的资料</div></td>
</tr><tr><td><div align="center">
					<img border="0"  src="<%=Form_userphoto%>" width="<%=Form_FaceWidth%>"  height="<%=Form_Faceheight%>">
					<br><img src="images/blank.gif"  width="2" height="5"><br>
                    </div></td>
                  </tr>
                  <tr> 
                    <td> <div align="center">
                        <nobr>用户<%=DEF_PointsName%>: <%=money%>金币</nobr>    
                        </div></td>
                  </tr>
                </table>         
<br> <table width="90%" border="0" align="center" cellpadding="3" cellspacing="3">
<tr><td><div align="center"></div>
<!-- #include file=petnav.asp --></td>
</tr></table><br><table width="79%" border="0" align="center" cellpadding="3" cellspacing="3">
<tr><td width="100%"><div align="center"><img src="images/pet/27.gif"></div></td>
</tr></table><br><div align="right"></div></td>
<td><table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td><div align="center"><a href="petitemmarket.asp?action=givesell">我要卖东西</a></div></td>
<td><div align="center"><a href="petitemmarket.asp?action=marketroom">武器柜台</a></div></td>
<td><div align="center"><a href="petitemmarket.asp?action=shownecklace">项链柜台</a></div></td>
<td><div align="center"><a href="petitemmarket.asp?action=showhead">头盔柜台</a></div></td>
<td><div align="center"><a href="petitemmarket.asp?action=showbody">盔甲柜台</a></div></td>
<td><div align="center"><a href="petitemmarket.asp?action=showfoot">鞋子柜台</a></div></td>
<td><div align="center"><a href="petitemmarket.asp?action=showupdate">升级柜台</a></div></td>
</tr></table></td></tr><tr><td width="72%" valign=top> 
<%
	if action<>"buy" and action<>"sell" and action<>"givesell" then
	dim atkdef
	atkdef=""
	select case action

		case "marketroom"
			sql = "SELECT * FROM itemmarket WHERE itemclass='sword' order by itemnum"
			atkdef="攻击力"
		
		case "shownecklace"
			sql = "SELECT * FROM itemmarket WHERE itemclass='necklace' order by itemnum"
			atkdef="攻击力"

		case "showhead"
			sql = "SELECT * FROM itemmarket WHERE itemclass='head' order by itemnum"
			atkdef="防御力"
		
		case "showbody"
			sql = "SELECT * FROM itemmarket WHERE itemclass='body' order by itemnum"
			atkdef="防御力"

		case "showfoot"
			sql = "SELECT * FROM itemmarket WHERE itemclass='foot' order by itemnum"
			atkdef="防御力"
		
		case "showupdate"
			sql = "SELECT * FROM itemmarket WHERE itemclass='update' order by itemnum"
			atkdef="数量"

	end select
	rs.open sql,connpet,1,1
	if rs.bof and rs.eof then response.write "目前没有人贩卖此类道具</td></tr></table>" : bbs94kk.Footer : response.end
	rs.movefirst
%>
<TABLE class=text1 cellSpacing=1 cellPadding=3 width=530 align=center border=0><TR> 
<TD width=100><DIV align=center>卖主</DIV></TD>
<TD width=100><DIV align=center>名字</DIV></TD>
<TD width=100><DIV align=center>形象</DIV></TD>
<TD width=100><DIV align=center><%=atkdef%></DIV></TD>
<TD width=100><DIV align=center>价格</DIV></TD>
<TD width=100><div align=center>购买选项</div></TD>
</TR>
<%
do while not rs.eof

if atkdef<>"数量" then
%>
<form action="petitemmarket.asp" name="name" method=post>
<TR>
<TD width=100><DIV align="center"><%=rs("itemuesr")%></DIV></TD>
<TD width=100><DIV align="center"><%=rs("ItemName")%></DIV></TD>
<TD width=100><DIV align="center"><IMG height=30 src="images/pet/<%=rs("ItemClass")%>/<%=rs("itemn")%>.gif" width=30></DIV></TD>
<TD width=100><DIV align="center">＋ <%=rs("itemNum")%></DIV></TD>
<TD width=100><DIV align="center"><%=rs("itemmoney")%></DIV></TD>
<TD width=100><div align="center">
<%if rs("itemuesr") <> bbs94kk.myname then%>
<input class='94kk' type="submit" value="购买">
<input class='94kk' type="hidden" name="action" value="buy">
<%else%>
<input class='94kk' type="submit" value="取消销售">
<input class='94kk' type="hidden" name="action" value="nosell">
<%end if%>
</div></TD>
<input class='94kk' type="hidden" name="itemname" value="<%=rs("itemname")%>">
<input class='94kk' type="hidden" name="itemclass" value="<%=rs("itemclass")%>">
<input class='94kk' type="hidden" name="itemNum" value="<%=rs("itemNum")%>">
<input class='94kk' type="hidden" name="itemN" value="<%=rs("itemN")%>">
<input class='94kk' type="hidden" name="id" value="<%=rs("id")%>">
</TR>
</form>
<%else%>
<form action=petitemmarket.asp name="name" method=post>
<TR>
<TD width=100><DIV align="center"><%=rs("itemuesr")%></DIV></TD>
<TD width=100><DIV align="center"><%=rs("ItemName")%></DIV></TD>
<TD width=100><DIV align="center">
<%if rs("itemN") = 0 then%>
<IMG height=40 src="images/pet/wp.gif" width=40>
<%else%>
<IMG height=40 src="images/pet/am.gif" width=40>
<%end if%>
</DIV></TD>
<TD width=100><DIV align="center"><%=rs("itemNum")%> 个</DIV></TD>
<TD width=100><DIV align="center"><%=rs("itemmoney")%></DIV></TD>
<TD width=100><div align="center">
<%if rs("itemuesr") <> bbs94kk.myname then%>
<input class='94kk' type="submit" value="购买">
<input class='94kk' type="hidden" name="action" value="buy">
<%else%>
<input class='94kk' type="submit" value="取消销售">
<input class='94kk' type="hidden" name="action" value="nosell">
<%end if%>
</div></TD>
<input class='94kk' type="hidden" name="itemname" value="<%=rs("itemname")%>">
<input class='94kk' type="hidden" name="itemclass" value="<%=rs("itemclass")%>">
<input class='94kk' type="hidden" name="itemNum" value="<%=rs("itemNum")%>">
<input class='94kk' type="hidden" name="itemN" value="<%=rs("itemN")%>">
<input class='94kk' type="hidden" name="id" value="<%=rs("id")%>">
</TR>
</form>
<%
end if 

rs.movenext
loop
rs.close

	elseif action = "givesell" then

	SQL = "SELECT * FROM mypetdata WHERE username='"&bbs94kk.myname&"'"
	set rs = connpet.execute(SQL)


	'用很无聊的循环使用变量得到每种道具的名字……
	dim rs3,swordname,necklacename,headname,bodyname,footname
	set rs3 = connpet.execute("select * from petitemshop where itemclass='sword' and itemnum="&rs("item1"))
	swordname = rs3("itemname")
	rs3.close
	set rs3 = connpet.execute("select * from petitemshop where itemclass='necklace' and itemnum="&rs("item2"))
	necklacename = rs3("itemname")
	rs3.close
	set rs3 = connpet.execute("select * from petitemshop where itemclass='head' and itemnum="&rs("item3"))
	headname = rs3("itemname")
	rs3.close
	set rs3 = connpet.execute("select * from petitemshop where itemclass='body' and itemnum="&rs("item4"))
	bodyname = rs3("itemname")
	rs3.close
	set rs3 = connpet.execute("select * from petitemshop where itemclass='foot' and itemnum="&rs("item5"))
	footname = rs3("itemname")
	rs3.close
%>
	<div align=center>
	<table class=text1 cellSpacing=1 cellPadding=3 width=530 align=center border=0 width="100%">
	<tr>
		<td width="25%" height="30" align=center>宠物装备/道具</td>
		<td width="25%" height="30" align=center>加强值/数量</td>
		<td width="25%" height="30" align=center>定价(总价)</td>
		<td width="25%" height="30" align=center>卖出</td>
	</tr>
	<tr><form action="petitemmarket.asp" method="post">
		<td width="25%" height="30" align=center><img height=30 src="images/pet/sword/<%=rs("item1")%>.gif" alt="<%=swordname%>"></td>
		<td width="25%" height="30" align=center>＋ <%=rs("item1Num")%></td>
		<td width="25%" height="30" align=center>
        <input class='94kk' type="text" name="itemmoney" size="20"></td>
		<td width="25%" height="30" align=center><input class='94kk' type="submit" value="贩卖"></td>
		<input class='94kk' type="hidden" name="action" value="sell">
		<input class='94kk' type="hidden" name="itemnum" value="<%=rs("item1Num")%>">
		<input class='94kk' type="hidden" name="itemname" value="<%=swordname%>">
		<input class='94kk' type="hidden" name="itemclass" value="sword">
		<input class='94kk' type="hidden" name="itemn" value="<%=rs("item1")%>">
		</form>
	</tr>
	<tr><form action="petitemmarket.asp" method="post">
		<td width="25%" height="30" align=center><img height=30 src="images/pet/necklace/<%=rs("item2")%>.gif" alt="<%=necklacename%>"></td>
		<td width="25%" height="30" align=center>＋ <%=rs("item2Num")%></td>
		<td width="25%" height="30" align=center>
        <input class='94kk' type="text" name="itemmoney" size="20"></td>
		<td width="25%" height="30" align=center><input class='94kk' type="submit" value="贩卖"></td>
		<input class='94kk' type="hidden" name="action" value="sell">
		<input class='94kk' type="hidden" name="itemnum" value="<%=rs("item2Num")%>">
		<input class='94kk' type="hidden" name="itemname" value="<%=necklacename%>">
		<input class='94kk' type="hidden" name="itemclass" value="necklace">
		<input class='94kk' type="hidden" name="itemn" value="<%=rs("item2")%>">
		</form>
	</tr>
	<tr><form action="petitemmarket.asp" method="post">
		<td width="25%" height="30" align=center><img height=30 src="images/pet/head/<%=rs("item3")%>.gif" alt="<%=headname%>"></td>
		<td width="25%" height="30" align=center>＋ <%=rs("item3Num")%></td>
		<td width="25%" height="30" align=center>
        <input class='94kk' type="text" name="itemmoney" size="20"></td>
		<td width="25%" height="30" align=center><input class='94kk' type="submit" value="贩卖"></td>
		<input class='94kk' type="hidden" name="action" value="sell">
		<input class='94kk' type="hidden" name="itemnum" value="<%=rs("item3Num")%>">
		<input class='94kk' type="hidden" name="itemname" value="<%=headname%>">
		<input class='94kk' type="hidden" name="itemclass" value="head">
		<input class='94kk' type="hidden" name="itemn" value="<%=rs("item3")%>">
		</form>
	</tr>
	<tr><form action="petitemmarket.asp" method="post">
		<td width="25%" height="30" align=center><img height=30 src="images/pet/body/<%=rs("item4")%>.gif" alt="<%=bodyname%>"></td>
		<td width="25%" height="30" align=center>＋ <%=rs("item4Num")%></td>
		<td width="25%" height="30" align=center>
        <input class='94kk' type="text" name="itemmoney" size="20"></td>
		<td width="25%" height="30" align=center><input class='94kk' type="submit" value="贩卖"></td>
		<input class='94kk' type="hidden" name="action" value="sell">
		<input class='94kk' type="hidden" name="itemnum" value="<%=rs("item4Num")%>">
		<input class='94kk' type="hidden" name="itemname" value="<%=bodyname%>">
		<input class='94kk' type="hidden" name="itemclass" value="body">
		<input class='94kk' type="hidden" name="itemn" value="<%=rs("item4")%>">
		</form>
	</tr>
	<tr><form action="petitemmarket.asp" method="post">
		<td width="25%" height="30" align=center><img height=30 src="images/pet/foot/<%=rs("item5")%>.gif" alt="<%=footname%>"></td>
		<td width="25%" height="30" align=center>＋ <%=rs("item5Num")%></td>
		<td width="25%" height="30" align=center>
        <input class='94kk' type="text" name="itemmoney" size="20"></td>
		<td width="25%" height="30" align=center><input class='94kk' type="submit" value="贩卖"></td>
		<input class='94kk' type="hidden" name="action" value="sell">
		<input class='94kk' type="hidden" name="itemnum" value="<%=rs("item5Num")%>">
		<input class='94kk' type="hidden" name="itemname" value="<%=footname%>">
		<input class='94kk' type="hidden" name="itemclass" value="foot">
		<input class='94kk' type="hidden" name="itemn" value="<%=rs("item5")%>">
		</form>
	</tr>
	<tr><form action="petitemmarket.asp" method="post">
		<td width="25%" height="30" align=center><img src="images/pet/wp.gif" width="40" height="40" border="0" alt="武器升级材料"></td>
		<td width="25%" height="30" align=center><input class='94kk' type="text" name="itemnum" size="5"> 共<font color=red><%=rs2("weopitem")%></font>个</td>
		<td width="25%" height="30" align=center>
        <input class='94kk' type="text" name="itemmoney" size="20"></td>
		<td width="25%" height="30" align=center><input class='94kk' type="submit" value="贩卖"></td>
		<input class='94kk' type="hidden" name="action" value="sell">
		<input class='94kk' type="hidden" name="itemname" value="武器升级材料">
		<input class='94kk' type="hidden" name="itemclass" value="update">
		<input class='94kk' type="hidden" name="itemn" value="0">
		</form>
	</tr>
	<tr><form action="petitemmarket.asp" method="post">
		<td width="25%" height="30" align=center><img src="images/pet/am.gif" width="40" height="40" border="0" alt="防具升级材料"></td>
		<td width="25%" height="30" align=center><input class='94kk' type="text" name="itemnum" size="5"> 共<font color=red><%=rs2("amoritem")%></font>个</td>
		<td width="25%" height="30" align=center>
        <input class='94kk' type="text" name="itemmoney" size="20"></td>
		<td width="25%" height="30" align=center><input class='94kk' type="submit" value="贩卖"></td>
		<input class='94kk' type="hidden" name="action" value="sell">
		<input class='94kk' type="hidden" name="itemname" value="防具升级材料">
		<input class='94kk' type="hidden" name="itemclass" value="update">
		<input class='94kk' type="hidden" name="itemn" value="1">
		</form>
	</tr>
	</table>
	</div>
<%
rs2.close
rs.close
end if
%>
<br>
<br>
</td>
</tr></table>
</td></tr></table>
<%bbs94kk.footer()%>