Hi,
I am working on a forgotpassword. asp page. I would like the user to enter their email address, and click submit. Upon submit, an email will be sent to the user's email address provided with the "password" they registered with.
I have posted my code below. However, I get an error on line 31:
The input name="email" on the html form that leads to this asp page.
Thanks for any input
I am working on a forgotpassword. asp page. I would like the user to enter their email address, and click submit. Upon submit, an email will be sent to the user's email address provided with the "password" they registered with.
I have posted my code below. However, I get an error on line 31:
Code:
Message = "You're password is:" & <%=objRS("Password" )%>
Thanks for any input
Code:
<%@ Language=VBScript %>
<% Option Explicit %>
<!--#include virtual="/adovbs.inc"-->
<html>
<head><title>Edit User Information</title></head>
<%
Dim oConn, oRs
Dim connectstr, sDSNDir, tablename
Dim db_name, db_username, db_userpassword
Dim dsn_name
dsn_name = "jerry_db.dsn"
tablename = "tblRegister"
db_username = "****"
db_userpassword = "****"
sDSNDir = Server.MapPath("/_dsn")
connectstr = "filedsn=" & sDSNDir & "/" & dsn_name
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim Message
EmailFrom = "jerry@digital.com"
EmailTo = Trim(Request.Form("email"))
Subject = "Here is your Password"
Message = "You're password is:" & <%=objRS("Password" )%>
Dim validationOK
validationOK=true
If (validationOK=false) Then Response.Redirect("index.html")
Dim Body
Body = Body & message
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send
Dim objRS, bolFound, strEmail
strEmail = Request.Form("email")
If ((Request.Form("email") = "") Then
oConn.Close
Set oConn = Nothing
%>
You must enter values for all the fields. Either hit the "back" button or click <a hred="login.html"> here to log in</a>
<%
Else
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "tblRegister", oConn, , adLockOptimistic, adCmdTable
bolFound = False
Do Until objRS.EOF OR bolFound
If (StrComp(objRS("Email"), strEmail, _
vbTextCompare) = 0) Then
BolFound = True
Else
objRS.MoveNext
End If
Loop
If Not bolFound Then
objRS.Close
Set objRS = Nothing
oConn.Close
Set oConn = Nothing
Response.Write "<a href='login.html'>"
Response.Write "Invalid Email Address.<p>"
Response.Write "</a>"
Response.End
End If
objRS("Email") = Request.Form("email")
objRS.Update
objRS.Close
Set objRS=Nothing
End If
oConn.Close
Set oConn = Nothing
%>
Your password has been sent to your email account. Please click <a href="login.html">here</a> to log in to your account.
</body>
</html>
Comment