This is what I'm trying to do.
A user should be able to receive an email with his/hers username and password throug the use of a page where they fill in their email. My thougt is that I let them fill out a form that contains one textfield where they fill in their email and I than check if that email is in the database and if so return an email to the same adress containing the users username and password.
This is how far I have got.
I have the regular loginpage.asp that contains a href that go to mail.asp.
Mail.asp contains the form the user fills in. On submit Mail.asp calls mailpassword.asp.
This far it's working:-) I can recieve an email containing the value inserted in the field epost in the form in Mail.asp.
For now I'm just trying to check if the email posted in the form is in the database. That's why I don't look for username and password anywhere!
But I don't get it to work with the database.
I'm sure it's the syntax that's wrong. I've tested my connection outside of this application and it works. But I don't get this to work.
This is some of my code in mailpassword.asp
<!--#include file="Connections/mail.asp" -->
Response.Expires = 0
Dim sAnvNamn, sAnvLosen, sAnvepost
Dim iErr, sRedirectUrl
iErr = 1
' *** Check if epost is in database
if Request.Form.Count > 0 then
Dim rs, sQuery , flag, usermail
set rs = Server.CreateObject(flag)
rs.ActiveConnection = mail_STRING
rs.Source = "SELECT Email"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 3
'rs.Source = rs.Source & " FROM dbo.UserData WHERE Email='" & Replace(MM_valUsername,"'","''") & "'"
rs.Source = select Email from dbo.UserData where Email='" & Request.querystring("epost") & "'"
if rs.RecordCount > 0 then
sAnvepost = rs("Email")
iErr = 0
if iErr <> 0 then 'gör om en felsida
sRedirectUrl = ""
Epost = Request.querystring("epost")
'***Send the results via email to someone
Set smtp = Server.CreateObject("CDONTS.NewMail")
smtp.MailFormat = 0 '(Mime format)
smtp.From = Epost
smtp.To = Epost
smtp.Subject = ""
smtp.Body = ": " & vbcrlf&_
+ "" & vbcrlf&_
+ "Username= " + Epost& vbcrlf&_
+ "Password= " + Epost& vbcrlf&_
+ "" & vbcrlf&_
+ "Good luck! "
Set smtp = Nothing
Is there anyone outthere that can help me with this?
Is it just the string rs.Source = select Email from dbo.UserData where Email='" & Request.querystring("epost") & "'" or is it something else?
The query works fine in analyzer.