%
'**************************************************************
' Version 4.00
' mail password to customer
' OOct 11, 2001
'*************************************************************
dim my_system
dim my_from
dim my_fromAddress
dim my_subject
dim my_to
dim my_toAddress
Dim my_attachment
Dim mailtype
Dim body
dim strpassword
'*******************************************************
' Sends password to customer by e-mail
'*******************************************************
dim dbc
dim UsePassword
Dim Fieldname
UsePassword="Yes" ' set to "Yes" for pasword instead of e-mail
AdLogin
'
Sub AdLogin()
sAction=Request.form("Action")
if saction="" then
sAction=Request.form("Action.x")
end if
If sAction = "" Then
ShopPageHeader
GetCustomerSessionData()
DisplayLoginForm()
ShopPageTrailer
Else
ShopPageHeader
ValidateLoginData()
If Serror ="" then
RetrieveLoginData
end if
if sError <>"" Then
DisplayLoginForm
else
MailtoCustomer
DisplayInfo
end if
ShopPageTrailer
end if
end Sub
Sub DisplayLoginForm()
if sError<> "" then
response.write "" & Getconfig("xfont") & SError & ""
Serror=""
end if
Response.Write("
")
Response.Write(Getconfig("xfont") & LangForgot01 & "" & "
")
Response.Write("")
Response.Write("
")
End Sub
Sub ValidateLoginData()
strLastname = Request.Form("strLastname")
strEmail = Request.Form("strEmail")
If strLastname = "" Then
if serror="" then
sError=langCommonrequired
end if
sError = sError & LangLoginLastName & "
"
End If
If strEmail = "" Then
if serror="" then
sError=langCommonrequired
end if
sError = sError & LangLoginEmail & "
"
End If
end sub
Sub RetrieveLogindata
Dim rs
dim myconn
dim templastname
templastname=replace(strlastname,"'","''")
SetSess "login", "Force"
OpenCustomerDb myconn
SetSess "Login", ""
sql = "select * from customers where lastname='" & templastname & "'"
sql = sql & " and " & " email='" & stremail & "'"
Set rs = myconn.Execute(SQL)
If Not rs.EOF Then
strfirstname = rs("firstname")
strlastname = rs("lastname")
stremail = rs("email")
strpassword=rs("password")
if strPassword="" or isnull(strpassword) then
SError = SError & Langpassword & " " & LangErrorNoProduct
end if
else
SError = SError & LangLoginLocateFail
strCustomerid=""
end if
rs.close
set rs=nothing
ShopClosedatabase myconn
end sub
'
Sub MailToCustomer
'******************************************************************
' Mail customer the password
'******************************************************************
body=LangPassword & "= " & strPassword & chr(13) & chr(10)
dim htmlformat, acount
acount=0
htmlformat="Text"
my_system=getconfig("xemailsystem")
mailtype=Getconfig("xemailtype")
my_subject=Langloginpassword & ": " & getconfig("xemailsubject")
my_from=getconfig("xemailname")
my_fromAddress=getconfig("xemail")
my_to=strFirstname & " " & strLastname ' this is name to email
my_toAddress=stremail ' this is actual email address
ExecuteMail mailtype,My_from,my_fromaddress,my_to,my_toaddress,my_subject,body,htmlformat,my_attachment,acount
end sub
Sub DisplayInfo
Response.write Getconfig("xfont") & "" & LangForgotInfo & "
"
end sub
%>