<% data_path="../" 'ACC连接数据库路径，对SQL无效 %>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/safe.asp"-->
<%
if issession=0 then
if request.Cookies("Yxmemberid")="" then
response.write "<script language='javascript'>"
response.write"parent.location.href='../login/login1.asp';</SCRIPT>"
response.end
end if
username=Replace_Text(request.Cookies("Yxmember"))
gsid=Replace_Text(request.Cookies("Yxmemberid"))
else
if session("id")="" then
response.write "<script language='javascript'>"
response.write"parent.location.href='../login/login1.asp';</SCRIPT>"
response.end
end if
username=session("user")
gsid=session("id")
end if 

'-------------------------
'--随机订单号
'-------------------------

Dim PostRanNum
	Randomize
	PostRanNum = Int(9000*rnd)+1000&year(now())&hour(now())&day(now())
	billno = PostRanNum

'-------------------------
'--订单保存
'-------------------------


gtype=request("gtype")   '判断是产品信息还是项目信息 返回1为项目信息，2为产品信息
bid=gsid       '买家公司ID
sid=request("sid")       '卖家公司ID
cpname=request("cpname") '产品名称
cpid=request("cpid")     '产品ID
ordernum=request("ordernum")	'订购数量
paytype=request("paytype")	'付款方式
tel=request("tel")	'联系电话
getadd=request("getadd")	'联系地址
lmsg=request("lmsg")	'买家留言

on error resume next
set rs=server.CreateObject("adodb.recordset")
sql="select * from yixiang_order_temp"
rs.open sql,conn,1,3
rs.addnew
	rs("billno")=billno
	rs("buycom")=gsid
	rs("salecom")=sid
	rs("ordernum")=ordernum
	rs("cpid")=cpid
	rs("gtype")=gtype
	rs("paytype")=paytype
	rs("buytel")=tel
	rs("getadd")=getadd
	rs("lmsg")=lmsg
	rs("buyuser")=username
	rs("viewkey")=0
	rs("dateandtime")=date()
	rs("saleshow")=1
	rs("buyshow")=1
rs.update
rs.close
if err.number<>0 then
	response.Redirect("orderfail.asp")
	response.end
else
	response.Redirect("orderok.asp?billno="&billno&"")
end if
%>