473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Forgotten Password script

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
1 4864
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: D E | last post by:
When using my web application manager (http://localhost:8080/admin) I forgot my password. Is there an XML file i can look at to remember/obtain (possibly even set). Thanks
10
by: Max | last post by:
Hello all, I am trying to protect a page within my site with a JS password scheme. Now I know JS can be quite easily "circumvented", but I came by a code below. My question is: 1. Is there...
7
by: Mike | last post by:
I've been trying for the past week to put a simple code together. I have done a LOT of searching, found scripts showing the functions I would like to use, however when I mix them it all goes wrong,...
1
by: Alfred E. Newman | last post by:
I want to enable visitors who have forgotten their password to request a new one. I have seen that some sites simply require users to enter their e-mail address. Then the server-side logic sends...
2
by: Showjumper | last post by:
A question regarding forgotten passwords - As i understand it, it is best and most secure to use a 1 way hash+salt to store passwwords, and then if the user has forgotten the password, generate a...
8
by: Katash | last post by:
Hello, I am new to PHP and am working on a login system for my site, currently supplied passwords are passed to MySQL and stored as md5 hashes, my question is :- seeing as md5 is 1 way only what...
3
Bhanu Murthy
by: Bhanu Murthy | last post by:
I shall be grateful if any body guide me to know where the password is stored in my database. I designed long back., now I have forgotten. Lot of data is there. People are using for the past 5...
4
by: prassaad | last post by:
Hi friends, I hv forgotten my password & unable log in on my system.... I hd tried by making system in SINGLE mode PLZ tell me different ideas to enhance my knowledge
9
by: twomt | last post by:
Hello, are there any tutorials/guides out there that explain how to handle this subject? I was thinking of having a member enter his username and email, after which I then email him a new...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.