
<% 
dim founderr,errmsg
founderr=false
errmsg=""
function ChkPost()
	dim server_v1,server_v2
	chkpost=false
	server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
	server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
	if mid(server_v1,8,len(server_v2))<>server_v2 then
		chkpost=false
	else
		chkpost=true
	End if
End function
session.Timeout=20
if ChkPost=false then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>请不要非法提交表单！！</a>！"
  Call diserror()
  response.End
End if
'inc_text=Server.HtmlEncode(request.form("inc_text"))
'i_type=trim(replace(request.form("i_type"),"'",""))
dim sql,rs
dim company,addr,tel,fax,linkman,proname,proxh,num,bz,ordertime
bookpost=trim(replace(request.form("bookpost"),"'",""))
if bookpost="bookpost" then
company=trim(replace(request.form("company"),"'",""))
addr=trim(replace(request.form("addr"),"'",""))
tel=trim(replace(request.form("tel"),"'",""))
fax=trim(replace(request.form("fax"),"'",""))
linkman=trim(replace(request.form("linkman"),"'",""))
proname=trim(replace(request.form("proname"),"'",""))
proxh=trim(replace(request.form("proxh"),"'",""))
num=trim(replace(request.form("num"),"'",""))
bz=trim(replace(request.form("bz"),"'",""))
ordertime=trim(replace(request.form("ordertime"),"'",""))
sql="select * from order1"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
if company="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>客户名称不能为空！"
else
  rs("company")=company
End if
if addr="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>联系地址不能为空！"
else
  rs("addr")=addr
End if
if tel="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>联系电话不能为空！"
else 
	rs("tel")=tel
End if
if proname="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>产品名称不能为空！"
else
   rs("proname")=proname
End if
if proxh="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>产品型号不能为空！"
else
   rs("proxh")=proxh
End if
if num="" then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>订购数量不能为空！"
elseif Not isInteger(num) then
  founderr=true
  errmsg=errmsg+"<br>"+"<li>正确填写订购数量！"
else
   rs("num")=num
End if
if Not founderr then
if fax<>"" then rs("fax")=fax
if linkman<>"" then rs("linkman")=linkman
if bz<>"" then rs("bz")=bz
rs("ordertime")=date
rs.update
rs.close
set rs=Nothing
closedatabase
Response.write "<script language = 'javascript'>alert('你已经成功订购此产品,我们会尽快处理!');window.document.location.href='Order.asp';</script>"
else
Call diserror()
Response.write "<script language = 'javascript'>alert('请正确填写订购信息!');window.document.location.href='javascript:history.back()';</script>"

response.End
End if
else
response.Redirect("Order.asp")
End if
%>

