<% Option Explicit %>
<!--#include file="../FS_Inc/Const.asp" -->
<!--#include file="../FS_Inc/Function.asp" -->
<!--#include file="../FS_InterFace/MF_Function.asp" -->
<!--#include file="lib/strlib.asp" -->
<!--#include file="lib/UserCheck.asp" -->
<%
'获得产品的实际价格
Function getPrice(pid)
	Dim productRs,price
	price=0
	Set productRs=Conn.execute("Select NewPrice from FS_MS_Products where ID="&pid)
	if not productRs.eof then
		if productRs("NewPrice")="" then
			price=0
		Else
			price=productRs("NewPrice")
		End if
	End if
	getPrice=price
End function 
Dim Rs,productID
'on error resume next
productID=NoSqlHack(request.QueryString("pid"))
if not isnumeric(productID) or productID="" then
	Response.Write("<script>history.back();</script>")
End if
if G_IS_SQL_User_DB=0 then
	User_Conn.execute("Insert into FS_ME_BuyBag (mid,BuyType,AddTime,UserNumber,BuyMoney,BuyNumber) values("&productid&",1,now(),'"&session("FS_Usernumber")&"',"&getPrice(productid)&",1)")
else
	User_Conn.execute("Insert into FS_ME_BuyBag (mid,BuyType,AddTime,UserNumber,BuyMoney,BuyNumber) values("&productid&",1,getdate(),'"&session("FS_Usernumber")&"',"&getPrice(productid)&",1)")
end if
if err.number=0 then
	Response.Redirect("BuyBag.asp")
Else
	Response.Redirect("lib/error.asp?ErrCodes=<li>"&err.description&"</li>")
End if
%>
<%
Set Conn = Nothing
Set Fs_User = Nothing
%>