script user loses loginaccount and email it to him

Results 1 to 2 of 2

Thread: script user loses loginaccount and email it to him

  1. #1
    Join Date
    Dec 1969

    Default script user loses loginaccount and email it to him

    I have a problem with a VBscript/sql/ASP-script to email a loginname and password per email to a user if he accidently should lose his loginaccountinfo.<BR><BR>I have a an Access database with a table named &#039login&#039 consisting out of "loginID, loginname (key), loginpassword, emailadress"<BR><BR>If a user loses his account, he can insert his emailadress in a form field. Where I get stuck how to write a SQL statement that compares his input with databasefield login.emailadress and if correct, then emails login.loginname and login.loginpassword to the emailadress.<BR><BR>Hope someone can show me the way.<BR><BR>Regards,<BR>Richard<BR>

  2. #2
    Join Date
    Dec 1969

    Default not too tricky!

    Okay well we can assume that no 2 people are going to have the same email address, but just to be EXTRA sure and error free i am going to take this into account and write some demo code for you...<BR><BR>dim conn,rs,sql,email<BR><BR>&#039request the email address...<BR>email = request.form("email")<BR>&#039do some email address validation, just to be safe...<BR><BR>set conn = server.createobject("adodb.connection")<BR>conn.op en "whatever_the_hell_your_dsn_is_called..."<BR>s ql = "SELECT * from tablename WHERE emailaddress = &#039"& email &"&#039<BR>set rs = conn.execute(sql)<BR><BR>while NOT rs.eof<BR><BR>email = rs.fields("emailaddress").value<BR>password = rs.fields("password").value<BR><BR>do cdonts..<BR><BR>rs.movenext<BR>loop<BR><BR>rs.clos e<BR>conn.close<BR>set rs = nothing<BR>set conn = nothing<BR><BR><BR><BR>i hope that helps! i just wrote your entire thing so like please learn from it.. and help others on the messageboard when u can<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts