Hi,
I have a member area on my website and recently someone forgot their username and password.....because of this I'm now trying to write a script that allows someone to enter their e-mail address and have their username and password e-mailed to them.
Below is what I have so far but how do I pull the username and password values from the database?
_________________________________________________
<%
'Save the e-mail address from the form
email = Request.Form ("email")
if email = "" then Response.Redirect("empty.asp")
CheckMail(Email)
Function CheckMail(Email)
Dim objRegExp , blnValid
Set objRegExp = New RegExp
objRegExp.Pattern = "^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
blnValid = objRegExp.Test(Email)
If NOT blnValid THEN Response.Redirect "invalid.asp"
End Function
'Build connection with database
set conn = server.CreateObject ("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=*************"
set rs = server.CreateObject ("ADODB.Recordset")
rs.Open "SELECT * FROM admin where email='"& email &"'", conn, 1
'If there is no record with the entered email, close connection
'and go back to login with QueryString
If rs.recordcount = 0 then
rs.close
conn.close
set rs=nothing
set conn=nothing
Response.Redirect("email_not_found.asp")
end if
_________________________________________________________
What do I do here?
Here's the next bit:
__________________________________________________________
dim objMail
' -- email variables --
objMail.To = Trim(email)
objMail.From = "webmistress@zoebirkett.net"
objMail.Subject = "ZBAS Registration Details"
objMail.BodyFormat = "0" ' HTML format
objMail.Body = "Hello " & Trim(fullname) & "!" & vbCrLf & vbCrLf & "Here are your details you requested. Please keep these safe!" & vbCrLf & vbCrLf & "Username: " & Trim(username) & vbCrLf & "Password: " & Trim(password1) & vbCrLf & vbCrLf & "Love Vicky :-) xxx" & vbCrLf & vbCrLf & "webmistress www.zoebirkett.net" & vbCrLf & vbCrLf & "The Zoe Birkett Appreciation Society!"
' -- send the email --
objMail.Send
' -- clean up object
Set objMail = Nothing
Response.Redirect("emailed.asp")
%>
_________________________________________________________
I would really really appreciate any help anyone can give me as this is actually part of a project I'm doing thats due in tomorrow (eeek!)
Thanks for reading!!
Loadsa love,
Vicky
xxx
Edited by vicky_c