Problems with an email verification

Results 1 to 2 of 2

Thread: Problems with an email verification

  1. #1
    Join Date
    Dec 1969

    Default Problems with an email verification

    I have made a site which allows the user to register for an account. When they register a unique, random 5 digit number is generated and sent to their email address (it is also written to the database.) They then enter it on another page and if it tallies with the database then another field in the database is checked true. The problem I am having is that I have created an error message to appear when the email verification number that the user has entered on the form does not appear in the database. Even if the database and the value entered in the form tallies then the error message still comes up. Here is the code:<BR><BR>--START OF CODE--<BR>&#060;html&#062;<BR> &#060;body bgcolor="#000000" text="#00ccff" link="#ff6666" vlink="#ff6666" alink="#ff9999"&#062;<BR> &#060;center&#062;<BR><BR>&#060;% <BR>Dim emailver &#039;the variable that stores the email verification code that the user entered from the form<BR>Dim emailvercheckSQL &#039;the variable that stores the SQL code that searches for the value stored in emailver<BR>Dim dbemailver &#039;the variable that stores the email verification code that is produced from searching the database with emailvercheckSQL<BR>Dim emailverifySQL &#039;the code that checks the "EmailVerified" field in the database as true<BR><BR>emailver = Request.QueryString("Emailver")<BR>emailvercheckSQ L = "SELECT EmailVNumber FROM UserInfo WHERE EmailVNumber=" & emailver &#039;quotes not used here because the field is a number<BR>emailverifySQL = "UPDATE UserInfo SET EmailVerified=&#039;1&#039; WHERE EmailVNumber=" & emailver &#039;ditto the above<BR><BR>set conn = server.createobject("ADODB.Connection")<BR>conn.op en "Accounts" &#039;opens the connection to the database<BR><BR>set emailvercheckup = conn.execute(emailvercheckSQL) &#039;runs the SQL code stored in emailvercheckSQL<BR>dbemailver = emailvercheckup(0) &#039;stores the results in the variable dbemailver<BR>response.write(dbemailver) &#039;These two lines I added for the purpose of helping me see whats going on, they are not intended to be in the final code but both of them returned the correct values which tells me that there is no error at this stage<BR>response.write(emailvercheckup(0)) &#039;ditto the above<BR><BR>If dbemailver &#060;&#062; emailver then &#039;This is MEANT to only display an alert if emailver and dbemailver are not equal, however, even if they are equal it displays the alert :(<BR>%&#062;<BR><BR>&#060;script language = "javascript"&#062;<BR>alert("That email address verification code is not valid.")<BR>{<BR>history.go(-1)<BR>}<BR>&#060;/script&#062;<BR><BR>&#060;% <BR>Else<BR><BR>set verifyemail = conn.execute(emailverifySQL) &#039;If everything else is perfect then this is run<BR><BR>End If<BR>%&#062;<BR><BR>Thanks, your email address has been verified and your account is ready to use.<BR><BR> &#060;/center&#062;<BR> &#060;/body&#062;<BR>&#060;/html&#062;<BR><BR>--END OF CODE--<BR><BR>Any help that anyone can give me with this would be very much appreciated.

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default You have debug

    but you dont show us what the value is.....dont you think that would have helped us??<BR><BR><BR>If CLng(dbemailver) &#060;&#062; CLng(emailver) then <BR><BR><BR>you MAY want to check for Nulls and Empty strings though....<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