<!--#include virtual="/purchase/_lib/_purchase_lib.asp"-->
<!--#include file="db.asp"-->
<%
Dim RS,Sql,sUid,i
Dim sItemTypeA,sItemNumA,sItemTypeAIndex
Dim recMan,recPhone,recEmail,recadd,reczip,orderid,orderno
Dim mailbody
sUid=Session("uid")
recMan=getFormElem("txtorderman") '获得接收订单者姓名
recPhone=getFormElem("txtrecPhone") '获得接收订单者电话
recEmail=getFormElem("txtrecEmail") '获得接收订单者Email
recadd=getFormElem("txtrecadd") '获得接收订单者地址
reczip=getFormElem("txtreczip") '获得接收订单者地址
'==================================================
' 参数设置开始,请修改相应参数
smtpserver ="smtp.163.com" '发送邮件所使用的SMTP服务器,例如smtp.163.com,请修改
smtpuser = "fengzhipaoniou10" '与SMTP服务器对应的邮箱用户名,请修改
smtppwd = "7330180" '与SMTP服务器对应的邮箱密码,请修改
'如果SMTP服务器需要发信认证,则设置登录SMTP服务器的用户名和密码
'与相应SMTP服务器对应的邮件地址
'注意:很多SMTP服务器除了要验证用户名和密码外,还要验证发件人地
'址,比如163.com的SMTP服务器在检查发信人邮件地址是不是以163.com
'结尾,否则不予发送,因此,使用相应的信箱做为发信人信箱是必要的
smtpemail = "fengzhipaoniou10@163.com" 'SMTP服务器发信邮箱,请修改
myemail="fengzhipaoniou10@163.com" '用来接收邮件的邮箱,请修改,可以与SMTP服务器发信邮箱不同
' 参数设置结束
'==================================================
'打开购物车
sItemTypeA=split(Session("CartItemTypeArray"),"@") '产品ID
sItemTypeAIndex=ubound(sItemTypeA)
sItemNumA=split(Session("CartItemNumArray"),"@") '产品数量
orderno=orderserie() '为购物车分配订单号
Conn.execute("insert into t_UserOrderCon(Odr_no,Odr_time,Odr_ispass,Asr_Id,Odr_sendState,Odr_Address,Odr_recName,Odr_zip,Odr_phone,Odr_email,Usr_Id,Odr_totalPrice)values('"&orderno&"',now(),0,1,0,'"&recadd&"','"&recMan&"','"&reczip&"','"&recPhone&"','"&recEmail&"',"&sUid&",0)") '订单入库
for i=0 to sItemTypeAIndex-1 '订单物品入库
Set RS=Conn.Execute("select St_typeid,Ste_value from t_GoodsCon where ste_id="&sItemTypeA(i))
If not rs.eof and not rs.bof then
Conn.Execute("insert into t_UserOrderDetail(Odr_no,St_typeid,Ste_id,List_num,Ste_Price)values('"&orderno&"',"&RS(0)&","&sItemTypeA(i)&",'"&sItemNumA(i)&"','"&sItemNumA(i)*RS(1)&"')")
end if
rs.close
set rs=nothing
next
mailbody=""
mailbody=mailbody&"<TABLE CELLSPACING=1 CELLPADDING=0 BORDER=0 WIDTH=100% >"
mailbody=mailbody&"<TR BGCOLOR=#558BFF>"
mailbody=mailbody&"<TD ALIGN=center CLASS=txt width='8%' height='25'><FONT COLOR=#ffffff>序号</FONT></TD>"
mailbody=mailbody&"<TD ALIGN=center width='20%' height='25'><FONT COLOR=#ffffff>物品名称</FONT></TD>"
mailbody=mailbody&"<TD ALIGN=center width='14%' height='25'><FONT COLOR=#ffffff>订购数量</FONT></TD>"
mailbody=mailbody&"<TD ALIGN=center width='13%' height='25'><FONT COLOR=#ffffff>价格</FONT></TD>"
mailbody=mailbody&"<TD ALIGN=center width='15%' height='25'><font color='#FFFFFF'>总价</font></TD></TR>"
'购物车列表
if sItemTypeAIndex>0 then
for i=0 to sItemTypeAIndex-1
Sql="select Ste_name,Ste_value from t_GoodsCon where ste_id="&sItemTypeA(i)
Set RS=Conn.Execute(sql)
If Not RS.eof And Not Rs.bof Then
mailbody=mailbody&"<TR BGCOLOR=#E1E1E1>"
mailbody=mailbody&"<TD ALIGN=center width='8%'>"&i+1
mailbody=mailbody&"</TD>"
mailbody=mailbody&"<TD ALIGN=center width='20%'>"&RS(0)
mailbody=mailbody&"</TD>"
mailbody=mailbody&"<TD ALIGN=center width='14%'>"&sItemNumA(i)
mailbody=mailbody&"</TD>"
mailbody=mailbody&"<TD ALIGN=center>"&RS(1)
mailbody=mailbody&"</TD>"
mailbody=mailbody&"<TD ALIGN=center>"&(RS(1))*sItemNumA(i)&"</TD></TR>"
End If
RS.Close
Next
End If
mailbody=mailbody&"</TABLE>"
mailbody=mailbody&"<HR SIZE=1>"
mailbody=mailbody&"<TABLE WIDTH=100% BORDER=0>"
mailbody=mailbody&"<TR><TD ALIGN=right width='22%'>下单人<FONT COLOR=#666666>真实姓名:</FONT></TD><TD width='78%' height='25'>"&recMan&"</TD></TR>"
mailbody=mailbody&"<tr><td align=right width='22%' height='25'><font color='#666666'>接收人地址:</font></td><td width='78%' height='25'>"&recadd&"</td></tr>"
mailbody=mailbody&"<tr><td align=right 'width='22%' height='25'><font color='#666666'>接收人邮编:</font></td><td width='78%' height='25'>"&reczip&"</td></tr>"
mailbody=mailbody&"<tr><td align=right 'width='22%' height='25'><font color='#666666'>接收人电话:</font></td><td width='78%' height='25'>"&recPhone&"</td></tr>"
mailbody=mailbody&"<tr><td align=right 'width='22%' height='25'><font color='#666666'>接收人Email:</font></td><td width='78%' height='25'>"&recEmail&"</td></tr></TABLE>"
set jmail= server.CreateObject ("jmail.message")
jmail.Silent = true
jmail.Charset = "gb2312"
JMail.ContentType = "text/html"
jmail.From = smtpemail
jmail.FromName = sendname
jmail.ReplyTo = email
jmail.Subject = topic
jmail.AddRecipient myemail
jmail.Body = mailbody
jmail.MailServerUserName = smtpuser
jmail.MailServerPassWord = smtppwd
isgo = jmail.Send(smtpserver)
if isgo then
msg="邮件发送成功!你可以等消息了。"
else
msg = "邮件发送失败!请检查您的参数设置是否正确!"
end if
jmail.Close
set jmail = nothing
'清空购物车
Session("CartItemTypeArray")=""
Session("CartItemNumArray")=""
%>
<script language="JavaScript">
<!--
alert("订购成功!");
window.location.href="default.asp"
//-->
</script>
<!--#include virtual="/purchase/_lib/_purchase_lib.asp"-->
<!--#include file="db.asp"-->
<%
Dim RS,Sql,sUid,i
Dim sItemTypeA,sItemNumA,sItemTypeAIndex
Dim recMan,recPhone,recEmail,recadd,reczip,orderid,orderno
Dim mailbody
sUid=Session("uid")
recMan=getFormElem("txtorderman") '获得接收订单者姓名
recPhone=getFormElem("txtrecPhone") '获得接收订单者电话
recEmail=getFormElem("txtrecEmail") '获得接收订单者Email
recadd=getFormElem("txtrecadd") '获得接收订单者地址
reczip=getFormElem("txtreczip") '获得接收订单者地址
'==================================================
' 参数设置开始,请修改相应参数
smtpserver ="smtp.163.com" '发送邮件所使用的SMTP服务器,例如smtp.163.com,请修改
smtpuser = "fengzhipaoniou10" '与SMTP服务器对应的邮箱用户名,请修改
smtppwd = "7330180" '与SMTP服务器对应的邮箱密码,请修改
'如果SMTP服务器需要发信认证,则设置登录SMTP服务器的用户名和密码
'与相应SMTP服务器对应的邮件地址
'注意:很多SMTP服务器除了要验证用户名和密码外,还要验证发件人地
'址,比如163.com的SMTP服务器在检查发信人邮件地址是不是以163.com
'结尾,否则不予发送,因此,使用相应的信箱做为发信人信箱是必要的
smtpemail = "fengzhipaoniou10@163.com" 'SMTP服务器发信邮箱,请修改
myemail="fengzhipaoniou10@163.com" '用来接收邮件的邮箱,请修改,可以与SMTP服务器发信邮箱不同
' 参数设置结束
'==================================================
'打开购物车
sItemTypeA=split(Session("CartItemTypeArray"),"@") '产品ID
sItemTypeAIndex=ubound(sItemTypeA)
sItemNumA=split(Session("CartItemNumArray"),"@") '产品数量
orderno=orderserie() '为购物车分配订单号
Conn.execute("insert into t_UserOrderCon(Odr_no,Odr_time,Odr_ispass,Asr_Id,Odr_sendState,Odr_Address,Odr_recName,Odr_zip,Odr_phone,Odr_email,Usr_Id,Odr_totalPrice)values('"&orderno&"',now(),0,1,0,'"&recadd&"','"&recMan&"','"&reczip&"','"&recPhone&"','"&recEmail&"',"&sUid&",0)") '订单入库
for i=0 to sItemTypeAIndex-1 '订单物品入库
Set RS=Conn.Execute("select St_typeid,Ste_value from t_GoodsCon where ste_id="&sItemTypeA(i))
If not rs.eof and not rs.bof then
Conn.Execute("insert into t_UserOrderDetail(Odr_no,St_typeid,Ste_id,List_num,Ste_Price)values('"&orderno&"',"&RS(0)&","&sItemTypeA(i)&",'"&sItemNumA(i)&"','"&sItemNumA(i)*RS(1)&"')")
end if
rs.close
set rs=nothing
next
mailbody=""
mailbody=mailbody&"<TABLE CELLSPACING=1 CELLPADDING=0 BORDER=0 WIDTH=100% >"
mailbody=mailbody&"<TR BGCOLOR=#558BFF>"
mailbody=mailbody&"<TD ALIGN=center CLASS=txt width='8%' height='25'><FONT COLOR=#ffffff>序号</FONT></TD>"
mailbody=mailbody&"<TD ALIGN=center width='20%' height='25'><FONT COLOR=#ffffff>物品名称</FONT></TD>"
mailbody=mailbody&"<TD ALIGN=center width='14%' height='25'><FONT COLOR=#ffffff>订购数量</FONT></TD>"
mailbody=mailbody&"<TD ALIGN=center width='13%' height='25'><FONT COLOR=#ffffff>价格</FONT></TD>"
mailbody=mailbody&"<TD ALIGN=center width='15%' height='25'><font color='#FFFFFF'>总价</font></TD></TR>"
'购物车列表
if sItemTypeAIndex>0 then
for i=0 to sItemTypeAIndex-1
Sql="select Ste_name,Ste_value from t_GoodsCon where ste_id="&sItemTypeA(i)
Set RS=Conn.Execute(sql)
If Not RS.eof And Not Rs.bof Then
mailbody=mailbody&"<TR BGCOLOR=#E1E1E1>"
mailbody=mailbody&"<TD ALIGN=center width='8%'>"&i+1
mailbody=mailbody&"</TD>"
mailbody=mailbody&"<TD ALIGN=center width='20%'>"&RS(0)
mailbody=mailbody&"</TD>"
mailbody=mailbody&"<TD ALIGN=center width='14%'>"&sItemNumA(i)
mailbody=mailbody&"</TD>"
mailbody=mailbody&"<TD ALIGN=center>"&RS(1)
mailbody=mailbody&"</TD>"
mailbody=mailbody&"<TD ALIGN=center>"&(RS(1))*sItemNumA(i)&"</TD></TR>"
End If
RS.Close
Next
End If
mailbody=mailbody&"</TABLE>"
mailbody=mailbody&"<HR SIZE=1>"
mailbody=mailbody&"<TABLE WIDTH=100% BORDER=0>"
mailbody=mailbody&"<TR><TD ALIGN=right width='22%'>下单人<FONT COLOR=#666666>真实姓名:</FONT></TD><TD width='78%' height='25'>"&recMan&"</TD></TR>"
mailbody=mailbody&"<tr><td align=right width='22%' height='25'><font color='#666666'>接收人地址:</font></td><td width='78%' height='25'>"&recadd&"</td></tr>"
mailbody=mailbody&"<tr><td align=right 'width='22%' height='25'><font color='#666666'>接收人邮编:</font></td><td width='78%' height='25'>"&reczip&"</td></tr>"
mailbody=mailbody&"<tr><td align=right 'width='22%' height='25'><font color='#666666'>接收人电话:</font></td><td width='78%' height='25'>"&recPhone&"</td></tr>"
mailbody=mailbody&"<tr><td align=right 'width='22%' height='25'><font color='#666666'>接收人Email:</font></td><td width='78%' height='25'>"&recEmail&"</td></tr></TABLE>"
set jmail= server.CreateObject ("jmail.message")
jmail.Silent = true
jmail.Charset = "gb2312"
JMail.ContentType = "text/html"
jmail.From = smtpemail
jmail.FromName = sendname
jmail.ReplyTo = email
jmail.Subject = topic
jmail.AddRecipient myemail
jmail.Body = mailbody
jmail.MailServerUserName = smtpuser
jmail.MailServerPassWord = smtppwd
isgo = jmail.Send(smtpserver)
if isgo then
msg="邮件发送成功!你可以等消息了。"
else
msg = "邮件发送失败!请检查您的参数设置是否正确!"
end if
jmail.Close
set jmail = nothing
'清空购物车
Session("CartItemTypeArray")=""
Session("CartItemNumArray")=""
%>
<script language="JavaScript">
<!--
alert("订购成功!");
window.location.href="default.asp"
//-->
</script>
这是后台处理
前台处理页:
<%
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
' 功能:购物车列表、提交到服务台页
' @Language=VBscript
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
%>
<!--#include virtual="/purchase/_lib/_purchase_lib.asp"-->
<!--#include file="db.asp"-->
<%
Dim RS,Sql,sUid,i
Dim sItemTypeA,sItemNumA,sItemTypeAIndex,sNowItemTypeAIndex
sUid=Session("uid")
's
if sUid="" or isnull(sUid) then
Session("goUrl")="dgservice.asp"
Response.Redirect("default.asp")
response.end
end if
'打开购物车
sItemTypeA=split(Session("CartItemTypeArray"),"@")
sItemTypeAIndex=ubound(sItemTypeA)
sItemNumA=split(Session("CartItemNumArray"),"@")
%>
<HTML>
<HEAD>
<title>电子商城</title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<LINK REL="stylesheet" HREF="/inc/css/pub.css" TYPE="TEXT/CSS">
<SCRIPT LANGUAGE="JavaScript" src="/purchase/js/purchase.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function clicktemp1(){
document.frmservice.txtrecadd.value=document.frmservice.temp1.value
document.frmservice.txtreczip.value=document.frmservice.temp2.value
document.frmservice.txtreceiver.value=document.frmservice.txtorderman.value
}
function clicktemp2(){
document.frmservice.txtrecadd.value=""
document.frmservice.txtreczip.value=""
document.frmservice.txtreceiver.value=""
}
//-->
</SCRIPT>
</HEAD>
<BODY BGCOLOR=#ffffff TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!--#include virtual="/inc/all_top.asp" -->
<!--#include virtual="/inc/all_first_top.asp" -->
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=710>
<TR>
<TD COLSPAN=3><IMG SRC="../images/dot.gif" WIDTH="1" HEIGHT="10" BORDER=0 ALT=""></TD>
</TR>
<TR>
<TD WIDTH=170 ALIGN=right VALIGN=top>
<!--#include virtual="/inc/default_left.asp" -->
</TD>
<TD WIDTH=20><IMG SRC="/images/dot.gif" WIDTH="20" HEIGHT="1" BORDER=0 ALT=""></TD>
<TD WIDTH=520 VALIGN=top CLASS=txt> <BR>
1、如果需要修改请到订购车处进行。
<HR SIZE=1>
<FORM Name="frmservice" METHOD=POST ACTION="dgservices.asp">
<TABLE CELLSPACING=1 CELLPADDING=0 BORDER=0 WIDTH=100%>
<TR BGCOLOR=#558BFF>
<TD ALIGN=center CLASS=txt width="8%" height="25"><FONT COLOR=#ffffff>序号</FONT></TD>
<TD ALIGN=center CLASS=txt width="20%" height="25"><FONT COLOR=#ffffff>物品名称</FONT></TD>
<TD ALIGN=center CLASS=txt width="14%" height="25"><FONT COLOR=#ffffff>订购数量</FONT></TD>
<TD ALIGN=center CLASS=txt width="13%" height="25"><FONT COLOR=#ffffff>价格</FONT></TD>
<TD ALIGN=center CLASS=txt width="15%" height="25"><font color="#FFFFFF">总价</font></TD>
</TR>
<% '购物车列表
if sItemTypeAIndex>0 then
%>
<% for i=0 to sItemTypeAIndex-1%>
<% Sql="select Ste_name,Ste_value from t_GoodsCon where ste_id="&sItemTypeA(i)
Set RS=Conn.Execute(sql)
If Not RS.eof And Not Rs.bof Then
%>
<TR BGCOLOR=#E1E1E1>
<TD ALIGN=center CLASS=txt width="8%">
<% response.write i+1 %>
</TD>
<TD ALIGN=center CLASS=txt width="20%">
<%response.write RS(0)%>
</TD>
<TD ALIGN=center CLASS=txt width="14%">
<%response.write sItemNumA(i)%>
</TD>
<TD ALIGN=center CLASS=txt>
<%response.write RS(1)%>
</TD>
<TD ALIGN=center CLASS=txt>
<%response.write (RS(1))*sItemNumA(i)%>
</TD>
</TR>
<%
End If
RS.Close
Next
Else%>
<TR BGCOLOR=#E1E1E1>
<TD ALIGN=center CLASS=txt colspan="5" height="25">还没有订购物品!</TD>
</TR>
<%
End If
%>
</TABLE>
<HR SIZE=1>
<% set RS=Conn.Execute("select Usr_realname,Usr_email,Usr_address,Usr_zip,Usr_tel from t_UserInfo where Usr_Id="&sUid)%>
<TABLE WIDTH=100% BORDER=0>
<TR>
<TD ALIGN=right CLASS=txt width="22%">下单人<FONT COLOR=#666666>真实姓名:</FONT></TD>
<TD width="78%" height="25">
<% if not Rs.eof and not rs.bof then %>
<INPUT TYPE="text" NAME="txtorderman" SIZE=28 value="<% response.write RS(0)%>">
<% else %>
<INPUT TYPE="text" NAME="txtorderman" SIZE=28 >
<% End If %>
</TD>
</TR>
<tr>
<td align=right class=txt width="22%" height="25"><font color="#666666">接收人地址:</font></td>
<td width="78%" height="25">
<%if not rs.eof and not rs.bof then%>
<input type="text" name="txtrecadd" size=58 value="<%response.write RS(2)%>">
<%else%>
<input type="text" name="txtrecadd" size=58 value="">
<%
end if
%>
</td>
</tr>
<tr>
<td align=right class=txt width="22%" height="25"><font color="#666666">接收人邮编:</font></td>
<td width="78%" height="25">
<%if not rs.eof and not rs.bof then%>
<input type="text" name="txtreczip" size=15 value="<%response.write RS(3)%>">
<%else%> <input type="text" name="txtreczip" size=15 value="">
<%
end if
%>
</td>
</tr>
<tr>
<td align=right class=txt width="22%" height="25"><font color="#666666">接收人电话:</font></td>
<td width="78%" height="25">
<%if not rs.eof and not rs.bof then%>
<input type="text" name="txtrecPhone" size=58 value="<%response.write RS(4)%>">
<%else%><input type="text" name="txtrecPhone" size=58 value="">
<%
end if
%>
</td>
</tr>
<tr>
<td align=right class=txt width="22%" height="25"><font color="#666666">接收人Email:</font></td>
<td width="78%" height="25">
<%if not rs.eof and not rs.bof then%>
<input type="text" name="txtrecEmail" size=58 value="<%response.write RS(1)%>">
<%else%><input type="text" name="txtrecEmail" size=58 value="">
<%
end if
%>
</td>
</tr>
<tr align="center">
<td class=txt colspan="2" height="25">
<input type="image" border="0" name="imageField2" src="/images/send.gif" width="84" height="15">
</td>
</tr>
</TABLE>
</FORM>
<HR SIZE=1>
<BR>
</TD>
</TR>
</TABLE>
<BR>
<!--#include virtual="/inc/default_end.asp" -->
<BR>
</BODY>
</HTML>
希望给在这个问题发愁的朋友,有帮助.