<%
'if the form has been submitted with details filled in
If Request.Form <> "" Then
'Declare variables
Dim oConnection, oRecordset, sSQL, sMessage, sUserName
Dim sPassword, sEmail_Body, sEmail, sSubject
sEmail = Request.Form("txtemail")
Set oConnection=Server.CreateObject("ADODB.connection")
Set oRecordset=Server.CreateObject("ADODB.recordset")
oConnection.Open(sConnString)
sSQL = "SELECT * FROM tblMembers WHERE Email ='" & sEmail & "' AND ACTIVE='Y'"
oRecordset.Open sSQL, oConnection
If oRecordset.BOF AND oRecordset.EOF Then
sMessage = "Your Email address does not exist in the list of approved users."
Else
sUserName = oRecordset("UserName")
sPassword = oRecordset("MembersPassword")
'Send out an email to member with forgotten password
sSubject=sSitename & " Forgotten Password"
sEmail_body="Your username is : " & sUsername & _
"
Your password is : " & sPassword
Call SendEmail(sEmail, sSubject, sEmail_body, sAdminEmail, "HTML")
sMessage = "Your login details have been sent to your email address."
End If
oRecordset.Close
oConnection.Close
Set oRecordset = Nothing
Set oConnection = Nothing
'once the form has been submitted and there are no errors
Response.write "" & sMessage & "
"
End If
%>