%
'**************************************************************
' Version 6.50
' mail password to customer
' March 26, 2004 Fix userid prompt when using userid
'*************************************************************
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
shopwriteError sError
Serror=""
end if
shopwriteheader getlang("LangForgot01")
Response.Write("
")
End Sub
Sub ValidateLoginData()
'VP-ASP 6.50 - precautionary security fix
strLastname = cleanchars(Request.Form("strLastname"))
strEmail = cleanchars(Request.Form("strEmail"))
If strLastname = "" Then
if serror="" then
sError= getlang("langCommonrequired")
end if
sError = sError & getlang("LangLoginLastName") & "
"
End If
If strEmail = "" Then
if serror="" then
sError= getlang("langCommonrequired")
end if
sError = sError & getlang("LangLoginEmail") & "
"
End If
'VP-ASP 6.50 - add a random string to email form to stop bots spamming it
if getconfig("xprotectemailforms") = "Yes" then
%><%
If blnCAPTCHAcodeCorrect Then
'Fine
Else
sError = sError & getlang("langcaptchawrong") & "
"
End If
End if
'VP-ASP 6.50 - validate email address
If Not InStr(strEmail, "@") > 1 Then
Serror=Serror & getlang("langInvalidEmail") & "
"
end if
end sub
Sub RetrieveLogindata
Dim rs
dim myconn
dim templastname, tempemail
templastname=replace(strlastname,"'","''")
templastname=cleanchars(templastname) 'VP-ASP 6.08a - Security Fix
tempemail=replace(stremail,"'","")
tempemail=cleanchars(tempemail) 'VP-ASP 6.08a - Security Fix
SetSess "login", "Force"
OpenCustomerDb myconn
SetSess "Login", ""
If getconfig("xcustomeruserid")<>"Yes" then
sql = "select * from customers where lastname='" & templastname & "'"
else
sql = "select * from customers where userid='" & templastname & "'"
end if
sql = sql & " and " & " email='" & tempemail & "'"
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 & getlang("Langpassword") & " " & getlang("LangErrorNoProduct")
end if
else
SError = SError & getlang("LangLoginLocateFail")
strCustomerid=""
end if
rs.close
set rs=nothing
ShopClosedatabase myconn
end sub
'
Sub MailToCustomer
'******************************************************************
' Mail customer the password
'******************************************************************
body= getlang("LangPassword") & "= " & strPassword & chr(13) & chr(10)
dim htmlformat, acount
acount=0
htmlformat="Text"
my_system=getconfig("xemailsystem")
mailtype=Getconfig("xemailtype")
my_subject= getlang("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 largeinfofont & getlang("LangForgotInfo") & largeinfoend & "
"
end sub
'VP-ASP 6.50 - add a random string to email form to stop bots spamming it
Sub CreateCAPTCHA
if getconfig("xprotectemailforms") <> "Yes" then exit sub
Response.write tablerow & tablecolumn
Response.write "*" & getlang("langcaptchaenter") & TablecolumnEnd
Response.write tablecolumn
getCAPTCHA
Response.write tablecolumnend & tableRowend
End Sub
%>