<!--#include file="Include/Const.Asp"-->
<!--#include file="Include/NoSQL.Asp" -->
<!--#include file="Include/ConnSiteData.Asp"-->
<%
If DateDiff("s", session("time"), Now())<Refresh Then
    response.Write "<script language='JavaScript'>alert('防刷新机制启动：请不要在 "&Refresh&" 秒内重复刷新！');" & "history.back()" & "</script>"
    response.End
Else
    session("time") = Now()
End If
Dim mOrderName, mRemark
Dim mMemID, mRealName, mSex, mCompany, mAddress, mZipCode, mTelephone, mFax, mMobile, mEmail, CheckCode
Dim rs, sql
mOrderName = Trim(request.Form("OrderName"))
mRemark = "订购以下产品：<br>"&request.Form("Products")&" 补充说明：<br>"&request.Form("Remark")
mMemID = request.QueryString("MemberID")
mRealName = Trim(request.Form("RealName"))
mSex = Trim(request.Form("Sex"))
mCompany = Trim(request.Form("Company"))
mAddress = Trim(request.Form("Address"))
mZipCode = Trim(request.Form("ZipCode"))
mTelephone = Trim(request.Form("Telephone"))
mFax = Trim(request.Form("Fax"))
mMobile = Trim(request.Form("Mobile"))
mEmail = Trim(request.Form("Email"))
CheckCode = Trim(request.Form("CheckCode"))
Dim ErrMessage, ErrMsg(9), FindErr(9), i
ErrMsg(0) = "请填写订单标题。"
ErrMsg(1) = "请填写订购者姓名。"
ErrMsg(2) = "请填写单位名称、详细地址。"
ErrMsg(3) = "请正确填写邮政编码。"
ErrMsg(4) = "请正确填写联系电话(11个字符以上)。"
ErrMsg(5) = "请正确填写传真号码、手机号码。"
ErrMsg(6) = "电子信箱格式错误。"
ErrMsg(7) = "验证码不能为空，请返回检查。"
ErrMsg(8) = "您在【产品订购】页面停留的时间过长，导致验证码失效。\n请返回并刷新【产品订购】页面重新订购！"
ErrMsg(9) = "您输入的验证码和系统产生的不一致，请重新输入。"
If Len(mOrderName)>100 Or Len(mOrderName) = 0 Then
    FindErr(0) = True
End If
If Len(mRealName)>50 Or Len(mRealName) = 0 Then
    FindErr(1) = True
End If
If Len(mCompany)>100 Or Len(Address)>100 Or Len(mCompany) = 0 Then
    FindErr(2) = True
End If
If Len(mZipCode)<>6 Then
    FindErr(3) = True
End If
If Len(mTelephone)>50 Or Len(mTelephone)<11 Or Len(mTelephone) = 0 Then
    FindErr(4) = True
End If
If Len(mFax)>50 Or Len(mFax) = 0 Or Len(mMobile) = 0 Or Len(mMobile)>50 Then
    FindErr(5) = True
End If
If Not IsValidEmail(mEmail) Then
    FindErr(6) = True
End If
If CheckCode = "" Then
    FindErr(7) = True
End If
If Trim(Session("CheckCode")) = "" Then
    FindErr(8) = True
End If
If CheckCode <> Session("CheckCode") Then
    FindErr(9) = True
End If
For i = 0 To UBound(FindErr)
    If FindErr(i) = True Then
        ErrMessage = ErrMessage+ErrMsg(i) + "\n"
    End If
Next
If Not (ErrMessage = "" Or IsNull(ErrMessage)) Then
    WriteMsg(ErrMessage)
    response.End
End If
Set rs = server.CreateObject("adodb.recordset")
sql = "select * from Shenbi_Order"
rs.Open sql, conn, 1, 3
rs.addnew
rs("OrderName") = StrReplace(mOrderName)
rs("Remark") = StrReplace(mRemark)
rs("MemID") = mMemID
rs("Linkman") = StrReplace(mRealName)
rs("Sex") = mSex
rs("Company") = StrReplace(mCompany)
rs("Address") = StrReplace(mAddress)
rs("ZipCode") = StrReplace(mZipCode)
rs("Telephone") = StrReplace(mTelephone)
rs("Fax") = StrReplace(mFax)
rs("Mobile") = StrReplace(mMobile)
rs("Email") = mEmail
rs("AddTime") = Now()
rs.update
rs.Close
Set rs = Nothing
Session("NoList") = ""
response.Write "<script language='javascript'>alert('订单提交成功！订单处理状态请登录会员中心查看！');location.replace('Index.Asp');</script>"
%>