📄 shangpintj.asp
字号:
<!--#include file="conn.asp"-->
<html>
<head>
<title>商品推荐</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/css.css" rel="stylesheet" type="text/css">
<style>
td{font-size:9pt;line-height:120%;color:#353535}
body{font-size:9pt;line-height:120%}
a:link { color: #000000; text-decoration: none }
a:visited { color: #000000; text-decoration: none }
a:active { color: #000000; text-decoration: none }
a:hover { color: #336699; text-decoration: none; position: relative; right: 0px; top: 1px }
</style>
</head>
<body leftmargin="3" topmargin="4" marginwidth="00">
<%
Product_id=request.QueryString("Product_id")
action=request.QueryString("action")
if action="save" then
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from Product where Product_id='"&Product_id&"'",conn,1,1
Product_Name=rs("Product_Name")
p_shop=rs("p_shop")
rs.close
set rs=nothing
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from shop where shop_name1='"&p_shop&"'",conn,1,1
mail=rs("Email")
shop_name2=rs("shop_name2")
rs.close
set rs=nothing
url_1= "http://" & Request.ServerVariables("HTTP_HOST")&"/"&p_shop&"/default.asp?sb=product&Product_id="&Product_id
url_2= "http://" & Request.ServerVariables("HTTP_HOST")&"/"&p_shop
'邮件发送程序============================================
on error resume next '忽略邮址错误
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.Charset = "gb2312"
JMail.ServerAddress =""
JMail.Priority = 3 '高优先级
JMail.contenttype ="text/html" '格式 默认为text/txt
JMail.Sender = mail '指定发件人的邮件地址
JMail.Subject =request.Form("myname")&"向你推荐的商品" ' 邮件标题
JMail.SenderName = shop_name2 '指定发件人的姓名
JMail.ReplyTo = mail '可选的回信地址
JMail.AddRecipient( request.Form("friendemail") ) '收件人
mailbody="<html>"
mailbody=mailbody & "<title>商品推荐</title>"
mailbody=mailbody & "<body>"
mailbody=mailbody & "<TABLE border=0 width='95%' align=center><TBODY><TR>"
mailbody=mailbody & "<TD valign=middle align=top>"
mailbody=mailbody & "尊敬的"&trim(request("friendname"))&":您好<br><br>"
mailbody=mailbody & " 您的朋友["&trim(request("myname"))&"]推荐给您一款最新商品,请点击以下链接查看详细情况<br><br>"
mailbody=mailbody & "商品名称: <a href="&url_1&" target=_blank>"&Product_Name&"</a><br><br><br>"
mailbody=mailbody & "欢迎光临: <a href="&url_2&" target=_blank>"&shop_name2&"</a><br><br><br>"
mailbody=mailbody & "</TD></TR></TBODY></TABLE><br><hr width=95% size=1>"
mailbody=mailbody & "</body>"
mailbody=mailbody & "</html>"
JMail.Body = mailbody '信件体正文为变量
JMail.Execute()
JMail.Close()
set jMail=nothing
if err then
sendmsg="对不起,由于系统错误,你的邮件不能成功发送。"
err.clear
else
sendmsg="发送成功"
end if
response.Write "<script language='javascript'>alert('"&sendmsg&"');window.close();</script>"
end if
%>
<table width="316" border="0" cellspacing="1" cellpadding="1" align="center" bgcolor="#FFCC00">
<tr>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="12v">
<tr>
<td class="12v" >
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="AutoNumber3" height="0" width="100%">
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr>
<form name="pinglunform" method="post" action="shangpintj.asp?action=save&Product_id=<%=Product_id%>" onsubmit="return check();">
<td>
<table width="100%" border="0" cellpadding="2" cellspacing="1">
<tr align="center">
<td colspan="2" height="22"><font color="#FF0000"><b>商 品 推 荐</b></font></td>
</tr>
<tr>
<td width="29%" align="right" height="22">朋友的姓名:</td>
<td width="71%" height="22">
<input name="friendname" style="BORDER-RIGHT: #ffffff 1px groove; BORDER-TOP: #ffffff 1px groove; BORDER-LEFT: #ffffff 1px groove; COLOR: #333333; BORDER-BOTTOM: #ffffff 1px groove; HEIGHT: 18px; BACKGROUND-COLOR: #ffcc66"; type="text" id="friendname" size="26">
</td>
</tr>
<tr>
<td width="29%" height="22" align="right">朋友的Email:</td>
<td width="71%" height="22">
<input name="friendemail" style="BORDER-RIGHT: #ffffff 1px groove; BORDER-TOP: #ffffff 1px groove; BORDER-LEFT: #ffffff 1px groove; COLOR: #333333; BORDER-BOTTOM: #ffffff 1px groove; HEIGHT: 18px; BACKGROUND-COLOR: #ffcc66"; type="text" id="friendemail" size="26">
</td>
</tr>
<tr>
<td width="29%" align="right" height="22">您的姓名:</td>
<td width="71%" height="22">
<input name="myname" style="BORDER-RIGHT: #ffffff 1px groove; BORDER-TOP: #ffffff 1px groove; BORDER-LEFT: #ffffff 1px groove; COLOR: #333333; BORDER-BOTTOM: #ffffff 1px groove; HEIGHT: 18px; BACKGROUND-COLOR: #ffcc66"; type="text" id="myname" size="26">
</td>
</tr>
<tr>
<td colspan="2" height="25">
<div align="center">
<input name="submit" type="image" src="IMAGES/fs.gif" width="45" height="19" border="0" onFocus="this.blur()">
</div>
</td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<script LANGUAGE="javascript">
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
function check()
{
if(checkspace(document.pinglunform.friendname.value)) {
document.pinglunform.friendname.focus();
alert("请填写朋友的姓名!");
return false;
}
if(checkspace(document.pinglunform.friendemail.value)) {
document.pinglunform.friendemail.focus();
alert("请填写朋友的Email!");
return false;
}
if(document.pinglunform.friendemail.value.length!=0)
{
if (document.pinglunform.friendemail.value.charAt(0)=="." ||
document.pinglunform.friendemail.value.charAt(0)=="@"||
document.pinglunform.friendemail.value.indexOf('@', 0) == -1 ||
document.pinglunform.friendemail.value.indexOf('.', 0) == -1 ||
document.pinglunform.friendemail.value.lastIndexOf("@")==document.pinglunform.friendemail.value.length-1 ||
document.pinglunform.friendemail.value.lastIndexOf(".")==document.pinglunform.friendemail.value.length-1)
{
alert("请正确填写朋友的Email!");
document.pinglunform.friendemail.focus();
return false;
}
}
else
{
alert("请填写朋友的Email");
document.pinglunform.friendemail.focus();
return false;
}
if(checkspace(document.pinglunform.myname.value)) {
document.myname.mayname.focus();
alert("请填写您的姓名!");
return false;
}
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -