Forums
This topic is locked
EMAIL CONFIRMATION AFTER REGISTRATION
Posted 27 Mar 2002 09:23:24
1
has voted
27 Mar 2002 09:23:24 Serge Chabert posted:
i have setup a automated email confirmation of registration on my website and when the user click on the submit button, the following message appears :Microsoft VBScript runtime error '800a01a8'
Object required: 'rsSubmitConfirm'
/serge/registersucces1.asp, line 15
THE EMAIL IS SENT TO THE USER HOWEVER.
Well to try it and see what i mean, i sugges
t you try the registering page which is :
www.freeasphost.co.uk/serge/register1.asp and submit a
registration. I think i have forgotten to put a piece of code. but i
don't know where.
Well i can send you as well the code on both pages.
REGISTER1.ASP PAGE
<%@LANGUAGE="VBSCRIPT"%>
<% Session("svUsername" = Request.Form("Username"%>
<!--#include file="Connections/serge.asp" -->
<%
' *** Edit Operations: declare variables
MM_editAction = CStr(Request("URL")
If (Request.QueryString <> "" Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<% Session("svUsername" = Request.Form("Username" %>
<%
' *** Redirect if username exists
MM_flag="MM_insert"
If (CStr(Request(MM_flag)) <> "" Then
MM_dupKeyRedirect="registerfailure.asp"
MM_rsKeyConnection=MM_serge_STRING
MM_dupKeyUsernameValue = CStr(Request.Form("Username")
MM_dupKeySQL="SELECT Username FROM users WHERE Username='" &
MM_dupKeyUsernameValue & "'"
MM_adodbRecordset="ADODB.Recordset"
set MM_rsKey=Server.CreateObject(MM_adodbRecordset)
MM_rsKey.ActiveConnection=MM_rsKeyConnection
MM_rsKey.Source=MM_dupKeySQL
MM_rsKey.CursorType=0
MM_rsKey.CursorLocation=2
MM_rsKey.LockType=3
MM_rsKey.Open
If Not MM_rsKey.EOF Or Not MM_rsKey.BOF Then
' the username was found - can not add the requested username
MM_qsChar = "?"
If (InStr(1,MM_dupKeyRedirect,"?" >= 1) Then MM_qsChar = "&"
MM_dupKeyRedirect = MM_dupKeyRedirect & MM_qsChar & "requsername=" &
MM_dupKeyUsernameValue
Response.Redirect(MM_dupKeyRedirect)
End If
MM_rsKey.Close
End If
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert") <> "" Then
MM_editConnection = MM_serge_STRING
MM_editTable = "users"
MM_editRedirectUrl = "registersucces.asp"
MM_fieldsStr =
"Firstname|value|Lastname|value|Username|value|Password|value|Email|value|Phone|value|Address|value|Zipcode|value|City|value|State|value|Country|value|Profession|value|Website|value|Favoritequote|value|Bio|value|Hobby|value|Latestnews|value"
MM_columnsStr =
"Firstname|',none,''|Lastname|',none,''|Username|',none,''|Password|',none,''|Email|',none,''|Phone|',none,''|Address|',none,''|Zipcode|',none,''|City|',none,''|State|',none,''|Country|',none,''|Profession|',none,''|Website|',none,''|Favoritequote|',none,''|Bio|',none,''|Hobby|',none,''|Latestnews|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"
' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And
Request.QueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
If (CStr(Request("MM_insert") <> "" Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),","
Delim = MM_typeArray(0)
If (Delim = "none" Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none" Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none" Then EmptyVal = ""
If (FormVal = "" Then
FormVal = EmptyVal
Else
If (AltVal <> "" Then
FormVal = AltVal
ElseIf (Delim = "'" Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''" & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues &
" values (" & MM_dbValues & ""
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
Dim strRecipient
strRecipient = rsSubmitConfirm.Field.Item("Email".Value
Dim myMail
Dim TheBody
Set myMail = CreateObject("VSEmail.SMTPSendMail"
myMail.From = " "
myMail.SendTo = Request("Email"
myMail.Subject = "Auto-Response From Registration At Young Blood"
TheBody = "Welcome " & Request("Username" & Chr(13) & Chr(13) & "Your
Username is : " & Request("Username" & Chr(13) & "Your Password is : "
& Request("Password" & Chr(13) & Chr(13) & "It may take one or two day
before you can login on the our website." & Chr(13) & Chr(13) &
"Regards, " & Chr(13) & Chr(13) & "The YoungBlood network team."
myMail.Body = TheBody
myMail.Connect
myMail.Send
Set myMail = Nothing
If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<html>
Replies
Replied 27 Mar 2002 09:28:40
27 Mar 2002 09:28:40 Serge Chabert replied:
and the REGISTERSUCCESS1.ASP PAGE :
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/serge.asp" -->
<%
Dim RssubmitConfirm__strUsername
RssubmitConfirm__strUsername = "xyz"
if (Session("svUsername" <> "" then RssubmitConfirm__strUsername =
Session("svUsername"
%>
<%
Dim strRecipient
Dim strFirstname
Dim strLastname
Dim strUsername
Dim strPassword
strRecipient = rsSubmitConfirm.Fields.Item("Email".Value
strFirstName = rsSubmitConfirm.Fields.Item("Firstname".Value
strLastName = rsSubmitConfirm.Fields.Item("Lastlame".Value
strUserName = rsSubmitConfirm.Fields.Item("Username".Value
strPassword = rsSubmitConfirm.Fields.Item("Password".Value
%>
<%
set RssubmitConfirm = Server.CreateObject("ADODB.Recordset"
RssubmitConfirm.ActiveConnection = MM_serge_STRING
RssubmitConfirm.Source = "SELECT * FROM users WHERE Username = '" +
Replace(RssubmitConfirm__strUsername, "'", "''" + "'"
RssubmitConfirm.CursorType = 0
RssubmitConfirm.CursorLocation = 2
RssubmitConfirm.LockType = 3
RssubmitConfirm.Open()
RssubmitConfirm_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Congratulation, <%=(RssubmitConfirm.Fields.Item("Firstname".Value)%>
<%=(RssubmitConfirm.Fields.Item("Lastname".Value)%> you have registered
successfully !!!! </p>
<p>Your Username is <%=(RssubmitConfirm.Fields.Item("Username".Value)%><br>
Your Password is <%=(RssubmitConfirm.Fields.Item("Password".Value)%></p>
<p>You are now a registered member.</p>
</body>
</html>
<%
RssubmitConfirm.Close()
%>
I AM GETTING CLOSE, DON'T I ? BUT WHAT DID I DO WRONG ?
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/serge.asp" -->
<%
Dim RssubmitConfirm__strUsername
RssubmitConfirm__strUsername = "xyz"
if (Session("svUsername" <> "" then RssubmitConfirm__strUsername =
Session("svUsername"
%>
<%
Dim strRecipient
Dim strFirstname
Dim strLastname
Dim strUsername
Dim strPassword
strRecipient = rsSubmitConfirm.Fields.Item("Email".Value
strFirstName = rsSubmitConfirm.Fields.Item("Firstname".Value
strLastName = rsSubmitConfirm.Fields.Item("Lastlame".Value
strUserName = rsSubmitConfirm.Fields.Item("Username".Value
strPassword = rsSubmitConfirm.Fields.Item("Password".Value
%>
<%
set RssubmitConfirm = Server.CreateObject("ADODB.Recordset"
RssubmitConfirm.ActiveConnection = MM_serge_STRING
RssubmitConfirm.Source = "SELECT * FROM users WHERE Username = '" +
Replace(RssubmitConfirm__strUsername, "'", "''" + "'"
RssubmitConfirm.CursorType = 0
RssubmitConfirm.CursorLocation = 2
RssubmitConfirm.LockType = 3
RssubmitConfirm.Open()
RssubmitConfirm_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Congratulation, <%=(RssubmitConfirm.Fields.Item("Firstname".Value)%>
<%=(RssubmitConfirm.Fields.Item("Lastname".Value)%> you have registered
successfully !!!! </p>
<p>Your Username is <%=(RssubmitConfirm.Fields.Item("Username".Value)%><br>
Your Password is <%=(RssubmitConfirm.Fields.Item("Password".Value)%></p>
<p>You are now a registered member.</p>
</body>
</html>
<%
RssubmitConfirm.Close()
%>
I AM GETTING CLOSE, DON'T I ? BUT WHAT DID I DO WRONG ?