By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,445 Members | 3,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,445 IT Pros & Developers. It's quick & easy.

Forgotten Password script

P: n/a
I'm a novice at coding and cannot get the script below to work I'm
receiving an Error 500 in the web browser when trying to run this script.
The site is www.murraywebs.com and the link is 'Retrieve Password' under the
logon form. the idea is to submit an email address and the password is
emailed to the user. (a very "basic" but common function of user management
systems).

The script(s) I'm using are based on
http://www.aspwebpro.com/tutorials/a...ectionopen.asp and
http://www.aspwebpro.com/aspscripts/...otpassword.asp. I've
made some adaptions to these scripts, because as they are, they don't work
either.

I'm using the JMail component on a Windows 2003 Server through my hosting
service www.spiritconnect.com.au

First there's a page with a email-form with one text field called "Email"
and a submit button that calls "confirm.asp" which contains the function to
send the password to the users email address.
Appreciate any help in troubleshooting. Code is below.

<form name="Password" method="POST" action="testconfirm.asp">
<table width="100%">
<tr><td>Email:</td>
<td><input type="text" name="Email" size="50">
<input type="submit" name="Submit" value="Submit">
</td></tr></table>
</form>

<%
'Dimension variables
DIM adoCon 'database connection variable
DIM strCon 'Holds Database drive and the path and the name of the database
DIM rsEmail 'Database Recordset variable
DIM strAccessDB ' holds name of the database
DIM strSQL 'Database query string
DIM strEmail 'Holds the email address of the user

'initalised the Email variable
strEmail = Request.Form("txtEmail")

'initialise the strAccessDB variable with the name of the Access Database

strAccessDB="/fpdb/murraywebs.mdb"

'if check for End of File

IF strEmail <"" THEN

'create a connection object

Set adoCon = Server.CreateObject("ADODB.Connection")

'Database connection info and driver

strCon="DRIVER={Microsoft Access Driver (*.mdb);uid=;pwd=;DBQ=" &
Server.MapPath(strAccessDB)

'Set an active connection to the Connection Object

adoCon.open strCon

'Create a Recordset Object

Set rsEmail = Server.CreateObject("ADODB.Recordset")

'initialise the strSQL variable with a SQL statement to query the database

strSQL = "SELECT tblUsers.Password FROM tblUsers WHERE tblUsers.Email = '"
& strEmail & "'"

'Query the Database

rsEmail.Open strSQL, strCon

'Check Recordset for matching email until EOF and if not found return error
page (Redirect)

IF rsEmail.EOF
THEN Response.Write "That email address was not found in our database.
Please click Back on your browser and enter the email address you registered
with."
ELSE

Dim strPwd 'holds password from database to send by email to strEmail
Dim objMail 'an instance of Persits ASPEmail
Dim strSenderAddr 'holds sender address which is the web server/site
Dim strSMTPServer 'holds name of the outgoing mail server
strSMTPServer = "mail.murraywebs.com"
strSenderAddr = "we*******@murrayebs.com
strPwd = rsEmail("Password")
set objMail = Server.CreateObject ("JMail.SMTPMail")

objMail.ServerAddress = strSMTPServer
objMail.Sender = strSenderAddr
objMail.Sender = strEmail
objMail.Subject = "Password Request from Murraywebs.com"
objMail.Body = "You requested your password by email:" & strEmail & crlf
objMail.Execute

Set objMail = Nothing

END IF

END IF

END IF

'close connection and all objects
Set adoCon = Nothing

%>

Apr 25 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Malformed changes to you script code
Error is on http://www.murraywebs.com/confirm.asp is
Microsoft VBScript compilation error '800a03f6'
Expected 'End'
/confirm.asp, line 67
ELSE

Do you have the all 3 line below on separate lines

IF rsEmail.EOF THEN
Response.Write "That email address was not found in our database. ..."
ELSE

I also see 3 End IF and only 2 IF in your posted code
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________
"Andrew Murray" <ad******************@iinet.net.auwrote in message news:%2****************@TK2MSFTNGP05.phx.gbl...
| I'm a novice at coding and cannot get the script below to work I'm
| receiving an Error 500 in the web browser when trying to run this script.
| The site is www.murraywebs.com and the link is 'Retrieve Password' under the
| logon form. the idea is to submit an email address and the password is
| emailed to the user. (a very "basic" but common function of user management
| systems).
|
| The script(s) I'm using are based on
| http://www.aspwebpro.com/tutorials/a...ectionopen.asp and
| http://www.aspwebpro.com/aspscripts/...otpassword.asp. I've
| made some adaptions to these scripts, because as they are, they don't work
| either.
|
| I'm using the JMail component on a Windows 2003 Server through my hosting
| service www.spiritconnect.com.au
|
| First there's a page with a email-form with one text field called "Email"
| and a submit button that calls "confirm.asp" which contains the function to
| send the password to the users email address.
|
|
| Appreciate any help in troubleshooting. Code is below.
|
| <form name="Password" method="POST" action="testconfirm.asp">
| <table width="100%">
| <tr><td>Email:</td>
| <td><input type="text" name="Email" size="50">
| <input type="submit" name="Submit" value="Submit">
| </td></tr></table>
| </form>
|
| <%
| 'Dimension variables
| DIM adoCon 'database connection variable
| DIM strCon 'Holds Database drive and the path and the name of the database
| DIM rsEmail 'Database Recordset variable
| DIM strAccessDB ' holds name of the database
| DIM strSQL 'Database query string
| DIM strEmail 'Holds the email address of the user
|
| 'initalised the Email variable
| strEmail = Request.Form("txtEmail")
|
| 'initialise the strAccessDB variable with the name of the Access Database
|
| strAccessDB="/fpdb/murraywebs.mdb"
|
| 'if check for End of File
|
| IF strEmail <"" THEN
|
| 'create a connection object
|
| Set adoCon = Server.CreateObject("ADODB.Connection")
|
| 'Database connection info and driver
|
| strCon="DRIVER={Microsoft Access Driver (*.mdb);uid=;pwd=;DBQ=" &
| Server.MapPath(strAccessDB)
|
| 'Set an active connection to the Connection Object
|
| adoCon.open strCon
|
| 'Create a Recordset Object
|
| Set rsEmail = Server.CreateObject("ADODB.Recordset")
|
| 'initialise the strSQL variable with a SQL statement to query the database
|
| strSQL = "SELECT tblUsers.Password FROM tblUsers WHERE tblUsers.Email = '"
| & strEmail & "'"
|
| 'Query the Database
|
| rsEmail.Open strSQL, strCon
|
| 'Check Recordset for matching email until EOF and if not found return error
| page (Redirect)
|
| IF rsEmail.EOF
| THEN Response.Write "That email address was not found in our database.
| Please click Back on your browser and enter the email address you registered
| with."
| ELSE
|
| Dim strPwd 'holds password from database to send by email to strEmail
| Dim objMail 'an instance of Persits ASPEmail
| Dim strSenderAddr 'holds sender address which is the web server/site
| Dim strSMTPServer 'holds name of the outgoing mail server
|
|
| strSMTPServer = "mail.murraywebs.com"
| strSenderAddr = "we*******@murrayebs.com
|
|
| strPwd = rsEmail("Password")
| set objMail = Server.CreateObject ("JMail.SMTPMail")
|
| objMail.ServerAddress = strSMTPServer
| objMail.Sender = strSenderAddr
| objMail.Sender = strEmail
| objMail.Subject = "Password Request from Murraywebs.com"
| objMail.Body = "You requested your password by email:" & strEmail & crlf
| objMail.Execute
|
| Set objMail = Nothing
|
| END IF
|
| END IF
|
| END IF
|
| 'close connection and all objects
| Set adoCon = Nothing
|
| %>
|
|
|
Apr 26 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.