%
Option Explicit
Dim strError, strSQL, objRS
'see if the form has been submitted
If Request.Form("action")="forgot" Then
'the form has been submitted, so check if a email has been entered
If Request.Form("email") = "" Then strError = strError & "- Please enter a email " & vbNewLine
'// check if an error has occured
If strError = "" Then
'continue include database connection code
%><%
strSQL = "SELECT id,email,password FROM tblMembers WHERE email='" & fixQuotes(Request.Form("email")) & "'"
Set objRS = objConn.Execute (strSQL)
'// see if there are any records returned
If objRS.EOF Then
strError = "- Invalid email. " & vbNewLine
Else
'send e-mail with password
dim oCdoMail, oCdoConf, sConfURL
Set oCdoMail = Server.CreateObject("CDO.Message")
Set oCdoConf = Server.CreateObject("CDO.Configuration")
sConfURL = "http://schemas.microsoft.com/cdo/configuration/"
with oCdoConf
.Fields.Item(sConfURL & "sendusing") = 2
.Fields.Item(sConfURL & "smtpserver") = "relay-hosting.secureserver.net"
.Fields.Item(sConfURL & "smtpserverport") = 25
.Fields.Item(sConfURL & "smtpauthenticate") = 1
.Fields.Item(sConfURL & "sendusername") = "relay@LovingLightAstrologer.com"
.Fields.Item(sConfURL & "sendpassword") = "relay"
.Fields.Update
end with
with oCdoMail
.From = "noreply@lovinglightastrologer.com"
.To = objRS("email")
.Subject = "Your lovinglightastrologer.com password"
.TextBody = "Your password for lovinglightastrologer.com is: " & objRS("password")
.HTMLBody = "Your password for lovinglightastrologer.com is: " & objRS("password")
.Configuration = oCdoConf
.Send
end with
Set oCdoConf = Nothing
Set oCdoMail = Nothing
'redirect to login area
Response.Redirect "login.asp?msg=Check+your+email+for+your+password."
Response.End
End If
End If
If strError <> "" Then
'output the error message
'add extra HTML...
strError = "
The following errors occured:" & _
" " & vbNewLine & strError
End If
'display message in URL.. (ie thank you for registering)
If Request.QueryString("msg") <> "" And strError = "" Then
strError = "
" & Request.QueryString("msg") & "
"
End If
End If
Function fixQuotes(strData)
fixQuotes = Replace(strData,"'","''")
End Function
're-set session data (ie log out)
Session("loggedin")=""
Session("userid")=""
%>
Login