<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--#include file="inc/conn.asp" -->
<!--#include file="inc/Function.asp" -->
<!--#include file="user/userSystem.asp" -->
<head>
<title>产品订购</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="images/yida.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
'版权：世纪伟成(http://yidacms.com)
'本信息不会影响您网站的正常访问，无论免费用户或是收费用户请保留这里的信息.
'如果您删除了这里的版权信息,将追究法律责任.
dim rs,sql
set rs=server.createobject("adodb.recordset")
sql="select * from book_management" 
rs.open sql,dbok,1,1

	if trim(rs("shuaiweb_buyyes")) = 2 then
		response.write ("订单系统已关闭，如需订购产品请拨打公司电话或与客服取得联系！")
		response.end                
			elseif trim(rs("shuaiweb_buyyes")) = 1 then

	if session("shuaiweb_useremail") = "" then
	yidacms_userportrait = "<img src=""template/user/images/u11.gif"">"
		else
	usersystem1()
	yidacms_userportrait = "<img src="""&rs("shuaiweb_userportrait")&""">"
	yidacms_useremail = rs("shuaiweb_useremail")
	yidacms_username = rs("shuaiweb_username")
	end if
	

if session("shuaiweb_useremail") = "" then
	yidacms_buy = ""
		else
	yidacms_buy = "<tr><td>E-mail账户<br /><input name=""shuaiweb_useremailbuy"" type=""text"" value="""&yidacms_useremail&""" readonly=""true"" class=""win""/></td><td rowspan=""6"">"&yidacms_userportrait&"</td></tr>"
end if


 
if request("yidacms")="buy" Then

if len(trim(request.Form("shuaiweb_buyamount")))<1 then
 response.write ("<script language=javascript> alert('订购数量必填且不能少于1个字符！');history.back(-1);</script>")
 response.end
end if
if len(trim(request.Form("shuaiweb_buyname")))<2 then
 response.write ("<script language=javascript> alert('订购者姓名必填且不能少于2个字符！');history.back(-1);</script>")
 response.end
end if
if len(trim(request.Form("shuaiweb_buytel")))<7 then
 response.write ("<script language=javascript> alert('电话必填且不能少于7个字符！');history.back(-1);</script>")
 response.end
end if

set rs=server.createobject("adodb.recordset")
sql="select * from shuaiweb_buy" 
rs.open sql,dbok,3,2
rs.addnew
	rs("shuaiweb_buyprname")=filter_Str(trim(request.form("shuaiweb_buyprname")))
	rs("shuaiweb_buyamount")=filter_Str(trim(request.form("shuaiweb_buyamount")))
	rs("shuaiweb_buyname")=filter_Str(trim(request.form("shuaiweb_buyname")))
	rs("shuaiweb_buytel")=filter_Str(trim(request.form("shuaiweb_buytel")))
	rs("shuaiweb_buyaddress")=filter_Str(trim(request.form("shuaiweb_buyaddress")))
	rs("shuaiweb_content")=filter_Str(trim(request.form("shuaiweb_content")))
	rs("shuaiweb_useremailbuy")=filter_Str(trim(request.form("shuaiweb_useremailbuy")))
	rs("shuaiweb_buyNumber")=filter_Str(trim(request.form("shuaiweb_buyNumber")))
rs.update
if yidacms_jmailuserbuy = 1 then
	if session("shuaiweb_useremail") = "" then
         mailtz = ""
          else
         yidacms_jmail(2)
	  if err.number<>0 then
		mailtz = "没有邮件发送!"
		 else
		mailtz =  "并给您发送了邮件通知，请注意查收!"
	  end if
    end if
    response.write "<script language=javascript> alert('成功提交！请等待我们与您联系！\n\n"&mailtz&"');javascript:window.close()</script>"
	response.end
  		elseif yidacms_jmailuserbuy = 2 then
    response.write "<script language=javascript> alert('成功提交！请等待我们与您联系');javascript:window.close()</script>"
	response.end
end if
	End If
		end if
                rs.Close
                set rs=nothing
				
buy_id = cint(request("id"))
set rs=server.createobject("adodb.recordset")
sql="select * from shuaiweb_products WHERE id = "&buy_id&"" 
rs.open sql,dbok,1,1
productsname = rs("shuaiweb_productsname")


%>
<table width="98%" border="0" cellpadding="8" cellspacing="0" bordercolor="#95C9E1" style="border-collapse:collapse" bgcolor="#FFFFFF">
<form id="form1" name="form1" method="post" action="buy.asp?yidacms=buy">
 <%=yidacms_buy%>
  <tr>
    <td>订购产品<br />
      <input name="shuaiweb_buyprname" type="text" id="shuaiweb_buyprname" value="<%=productsname%>" <%if txw_buytitle = "close" then %>readonly="true"<%end if%> class="win" /></td>
  </tr>
  <tr>
    <td>订购数量<br />
      <input name="shuaiweb_buyamount" type="text" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" class="win"/>
      <font color=red>(必填)</font></td>
    </tr>
  <tr>
    <td>订购人姓名<br />
      <input name="shuaiweb_buyname" type="text" id="shuaiweb_buyname" value="<%=yidacms_username%>" class="win"/>
      <font color=red>(必填)</font></td>
    </tr>
  <tr>
    <td>联系电话<br />
      <input name="shuaiweb_buytel" type="text" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" class="win"/>
      <font color=red>(必填)</font> +区号</td>
    </tr>
  <tr>
    <td>联系地址<br />
      <input name="shuaiweb_buyaddress" type="text" id="shuaiweb_buyaddress" class="win"/></td>
    </tr>
  <tr>
    <td>补充内容<br />
      <textarea name="shuaiweb_content" id="shuaiweb_content" cols="40" rows="8"></textarea>
      </td>
    <td><input type="hidden" name="shuaiweb_buyNumber" value="<%=FormatDate(now(),15)%>" /></td>
  </tr>
  <tr>
   <td>
     <input type="submit" name="Submit2" value="提交" class="anniu"/>
   </td>
  </tr>
      </form>
</table>
</body>
</html>