
<%
set rs = server.createobject("adodb.recordset")
sql="select * from shuaiweb_jemail"
rs.open sql,dbok,1,1
yidacms_jmailuser = rs("shuaiweb_jmail")
yidacms_jmailuserreg = rs("shuaiweb_jmailuserreg")
yidacms_jmailuserbuy = rs("shuaiweb_jmailuserbuy")
yidacms_jmailuserfa = rs("shuaiweb_jmailuserfa")
rs.Close
set rs=nothing

function usersys(a)
	set rs = server.createobject("adodb.recordset")
	sql="select * from shuaiweb_user where shuaiweb_useremail='"&session("shuaiweb_useremail")&"'"
	rs.open sql,dbok,1,1
        a = replace(a,"{$yidacms_useremail}",rs("shuaiweb_useremail"))
        a = replace(a,"{$yidacms_username}",rs("shuaiweb_username"))
        a = replace(a,"{$yidacms_userportrait}",rs("shuaiweb_userportrait"))
        a = replace(a,"{$yidacms_usertel}",rs("shuaiweb_usertel"))
        a = replace(a,"{$yidacms_userqq}",rs("shuaiweb_userqq"))
        a = replace(a,"{$yidacms_usermsn}",rs("shuaiweb_usermsn"))
        a = replace(a,"{$yidacms_useraddress}",rs("shuaiweb_useraddress"))
        a = replace(a,"{$yidacms_usernote}",rs("shuaiweb_usernote"))
        usersys=a
	rs.Close
	set rs=nothing
end function

function yidacms_regx(a)
	set rs = server.createobject("adodb.recordset")
	sql="select * from shuaiweb_userk"
	rs.open sql,dbok,1,1
        if rs("shuaiweb_userregoff") = "off" then
        	yidacms_TXWuserreg = "value=""不可以注册!"" disabled=""disabled"""
				 else
        	yidacms_TXWuserreg = ""
        end if
        a = replace(a,"{$yidacms_regx}",yidacms_TXWuserreg)
        yidacms_regx=a
	rs.Close
	set rs=nothing
end function

function yidacms_loginx(a)
	set rs = server.createobject("adodb.recordset")
	sql="select * from shuaiweb_userk"
	rs.open sql,dbok,1,1
        if rs("shuaiweb_userloginoff") = "off" then
       	 	yidacms_TXWuserlogin = "value=""不可以登录!"" disabled=""disabled"""
        	else
        	yidacms_TXWuserlogin = ""
        end if
        a = replace(a,"{$yidacms_loginx}",yidacms_TXWuserlogin)
        yidacms_loginx=a
	rs.Close
	set rs=nothing
end function

function usersystem1()
set rs = server.createobject("adodb.recordset")
sql="select * from shuaiweb_user where shuaiweb_useremail='"&session("shuaiweb_useremail")&"'"
rs.open sql,dbok,1,1
end function

function UserProducts(str)
set reg=new regexp
reg.IgnoreCase = False 
reg.Global = True 
reg.Pattern = "<UserProducts:\{(.+?)\}>([\s\S]*?)<UserProducts>"
set aa=reg.execute(str)
for each match in aa
bq=match.submatches(0)
nr=match.submatches(1)
Row=nbq(bq,"Row")
leixing=nbq(bq,"leixing")
Tlen=nbq(bq,"Tlen")
str=replace(str,match,Userchanpin(Row,nr,leixing,Tlen))
next
UserProducts=str
end function

Function Userchanpin(Row,yida_cms,leixing,Tlen)
  set rs = server.createobject("adodb.recordset")
if leixing = 5 then
	yidacms_shuxing = "05,"
end if
sql="select top "&Row&" * from shuaiweb_products where Instr(shuaiweb_productsstate,'"&yidacms_shuxing&"') ORDER BY id DESC"
rs.open sql,dbok,1,1
if rs.eof then
yida_cmsp = "暂无向您推荐的商品!"
else
Do While Not rs.EOF
if trim(rs("shuaiweb_productsminpic")) <> "" then
	productsxiaotu = sw_dizhi & rs("shuaiweb_productsminpic")
		else
	productsxiaotu = sw_dizhi & "images/Without.gif"
end if
if trim(rs("shuaiweb_productsmaxpic")) <> "" then
	productsdatu = sw_dizhi & rs("shuaiweb_productsmaxpic")
		else
	productsdatu = sw_dizhi & "images/Without.gif"
end if
yida_cms1=replace(yida_cms,"{Products:name}",left(rs("shuaiweb_productsname"),Tlen))
yida_cms2=replace(yida_cms1,"{Products:id}",rs("id"))
yida_cms3=replace(yida_cms2,"{Products:riqi}",FormatDate(rs("time"),4))
yida_cms4=replace(yida_cms3,"{Products:bianhao}",rs("shuaiweb_productsno"))
yida_cms5=replace(yida_cms4,"{Products:xinghao}",rs("shuaiweb_productsmodel"))
yida_cms6=replace(yida_cms5,"{Products:caizhi}",rs("wait_pryi"))
yida_cms7=replace(yida_cms6,"{Products:biaozhunjia}",rs("shuaiweb_productsbprice"))
yida_cms8=replace(yida_cms7,"{Products:youhuijia}",rs("shuaiweb_productsprice"))
yida_cms9=replace(yida_cms8,"{Products:kucunliang}",rs("shuaiweb_productsLibrary"))
yida_cms10=replace(yida_cms9,"{Products:jijiadanwei}",rs("shuaiweb_productsunits"))
yida_cms11=replace(yida_cms10,"{Products:chupingongsi}",rs("shuaiweb_productsco"))
yida_cms12=replace(yida_cms11,"{Products:xiaotu}",productsxiaotu)
yida_cms13=replace(yida_cms12,"{Products:datu}",productsdatu)
tt=tt+yida_cms13
    rs.movenext
  Loop
end if	
rs.Close
set rs=nothing
Userchanpin = tt & yida_cmsp
End Function

Function yidacms_jmail(leixing)
set rs = server.createobject("adodb.recordset")
sql="select * from shuaiweb_jemail"
rs.open sql,dbok,1,1
if rs("shuaiweb_jmail") = 1 then
On error resume next
Dim JMail, contentId
Set JMail = Server.CreateObject("JMail.Message") 
JMail.Charset = "gb2312"
JMail.From = rs("shuaiweb_jmailadmin")
JMail.FromName = sw_gongsibiaoti
if leixing = 1 then
JMail.Subject = "感谢您在本站注册会员！" & sw_dizhi
JMail.Body = replace(replace(rs("shuaiweb_jmailuserregn"),"{Yidacms:username}",trim(request.form("shuaiweb_username"))),"{Yidacms:usermail}",trim(request.form("shuaiweb_useremail")))
elseif leixing = 2 then
JMail.Subject = "您成功在本站提交订单，我们会尽快给您处理！"
JMail.Body = replace(replace(rs("shuaiweb_jmailuserbuyn"),"{Yidacms:userbuynumber}",trim(request.form("shuaiweb_buyNumber"))),"{Yidacms:userbuyproducts}",trim(request.form("shuaiweb_buyprname")))
elseif leixing = 3 then
JMail.Subject = "你订购的商品我们已发货，查看发货情况！"
JMail.Body = replace(replace(rs("shuaiweb_jmailuserfan"),"{Yidacms:username}",trim(request.form("shuaiweb_buyname"))),"{Yidacms:usertime}",trim(request.form("buytime")))
end if
'JMail.HTMLBody = "<html><head></head><body><META content=zh-cn http-equiv=Content-Language><meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"&rs("shuaiweb_jmailuserregn")&"</body></html>"
JMail.MailServerUserName = rs("shuaiweb_jmailname")
JMail.MailServerPassword = rs("shuaiweb_jmailpass")
JMail.Priority = 1
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.AddRecipient(""&session("shuaiweb_useremail")&"")
JMail.Send(""&rs("shuaiweb_jmailsmtp")&"")
JMail.Close()
Set JMail = Nothing
end if
end Function
%>