Forum Moderators: open

Message Too Old, No Replies

member registration page gives me an error

         

fototex

7:52 am on Jul 12, 2009 (gmt 0)

10+ Year Member



Hi friends,

I have an .asp page which registers customers to a database by taking their inputs from a previous page. It compares mainly the username and their e-mail with the db whether these have been previously used. The username comparison was working ok. Then I decided to add an e-mail comparison too but was unsuccessful.
Somewhere on the bottom of this page, it tells me that it needs a Expected 'End'. I have deleted some lines on the page so that it is not too long to post here.
I am sorry that it is already 4 pages long but beleive I have tried my best to make it shorter.

So here is the page which gives me the error message that an Expected 'End' is needed. I already have an <%end if%> on the bottom but it still complains that it is missing.
Thank you for your support

<SCRIPT LANGUAGE="JavaScript">
history.forward();
if (top.frames['mainsubframe'] == undefined){
window.location.href = "index.htm";
}
</SCRIPT>

<SCRIPT SRC="language-en.js"></SCRIPT>
<SCRIPT src="cart.js"></SCRIPT>

<body background="webimages/BGS/Gray.jpg" bgcolor="#D6D6DE" topmargin="2" leftmargin="35">

<%
dim k,i
dim DBflag
Dim currDate, formattedTime

i=0

if security(Trim(request.form("gkod2"))) = request.form("kgkod") then

Username= security(Trim(Request.Form("Username")))
Set RecordsetControl = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM Members where Username = '" & Username & "'"
RecordsetControl.Open SQL, Conn, 1, 2

If Not RecordsetControl.Eof Then
RecordsetControl.Close

%>

<br><br>
<table width="460" border="0" cellspacing="0" cellpadding="0" bordercolor="#003163" valign="top" style="border-collapse: collapse">
<tr>
<td valign="top" class="blacktext" background="BGS/Gray.jpg">
<STRONG><font face="Arial" size="2"> This username has been used before</font></STRONG>
</td>
</tr>
<tr>
<td valign="top" class="blacktext" background="BGS/Gray.jpg">
<STRONG><font face="Arial" size="2"> Please log in if you have previously registered</font></STRONG>
</td>
</tr>
<tr>
<td valign="top" class="blacktext" background="BGS/Gray.jpg">
<STRONG><font face="Arial" size="2"> Please press on forgot password if you can’t remember your password</font></STRONG>
</td>
</tr>
</table>

<%
Else
Email= security(Trim(Request.Form("Email")))
Set RecordsetControl = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM Members where Email = '" & Email & "'"
RecordsetControl.Open SQL, Conn, 1, 2

If Not RecordsetControl.Eof Then
RecordsetControl.Close

%>

<br><br>
<table width="460" border="0" cellspacing="0" cellpadding="0" bordercolor="#003163" valign="top" style="border-collapse: collapse">
<tr>
<td valign="top" class="blacktext" background="BGS/Gray.jpg">
<STRONG><font face="Arial" size="2"> This e-mail has been used before </font></STRONG>
</td>
</tr>
<tr>
<td valign="top" class="blacktext" background="BGS/Gray.jpg">
<STRONG><font face="Arial" size="2"> Please log in if you have previously registered </font></STRONG>
</td>
</tr>
<tr>
<td valign="top" class="blacktext" background="BGS/Gray.jpg">
<STRONG><font face="Arial" size="2"> Please press on “forgot password” if you can’t remember your password </font></STRONG>
</td>
</tr>
</table>

<%
Else
RecordsetControl.Close

FirstName = security(Trim(Request.Form("FirstName")))
LastName = security(Trim(Request.Form("LastName")))
Username = security(Trim(Request.Form("Username")))
Address1 = security(Trim(Request.Form("Address1")))
Otherinputs.......
Otherinputs.......

Dim MDate, MDateYear, MDateMonth, MDateDay
MDateYear = cStr(Year(Now()))
MDateMonth = cStr(Month(Now()))
if Len(MDateMonth) = 1 Then
MDateMonth = "0" + MDateMonth
End If
MDateDay = cStr(Day(Now()))
if Len(MDateDay) = 1 Then
MDateDay= "0" + MDateDay
End If
MDate = MDateYear + "" + MDateMonth + "" + MDateDay

Set Recordset2 = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM Members where 1 = 2"
Recordset2.Open SQL, Conn, 1, 2

Recordset2.AddNew

Recordset2("Email") = Email
Recordset2("Password") = Pass
Recordset2.......
Recordset2.......

Recordset2.Update
Recordset2.Close

session("ShippingFirstName") = FirstName
session("ShippingLastName") = LastName
session.....
session.....
%>

<br><br>
<table width="460" border="0" cellspacing="0" cellpadding="0" bordercolor="#003163" valign="top" style="border-collapse: collapse">
<tr>
<td valign="top" class="blacktext" background="BGS/Gray.jpg">
<STRONG><font face="Arial" size="2"> Your registration has been completed.</font></STRONG>
</td>
</tr>
<tr>
<td valign="top" class="blacktext" background="BGS/Gray.jpg">
<STRONG><font face="Arial" size="2"> We wish you a great year</font></STRONG>
</td>
</tr>
</table>

<%

dim myMail
set myMail= CREATEOBJECT("CDO.Message")
myMail.From = "info@example.com"
myMail.To = "Email"
myMail.Subject = "Welcome to example.com"
myMail.Textbody = "Dear " & FirstName + " " + LastName + ",welcome to example.com"
myMail.HTMLBody = htmbdy
htmbdy="<html><body><table><tr><td>Password: </td><td>"& Pass &"</td></tr></table></body></html>"

myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
myMail.Configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"

myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing

End If

elseif not security(Trim(request.form("gkod2")))=request.form("kgkod") then
%>
<script language="JavaScript">
alert('Please enter the correct security code');
javascrpt:history.back()
</script>
<%end if%>

</body>

</html>

[edited by: marcel at 8:31 am (utc) on July 12, 2009]
[edit reason] changed to example.com [/edit]

fototex

8:05 am on Jul 12, 2009 (gmt 0)

10+ Year Member



Sorry, here is the error message:

Error Type:
Microsoft VBScript compilation (0x800A03F6)
Expected 'End'
/memberregister.asp, line 213
elseif not security(Trim(request.form("gkod2")))=request.form("kgkod") then
--------------------------------------------------

marcel

8:29 am on Jul 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I compare the number of IF statements to that of END IF statements, you have two IFs that are not closed with an END IF.

Walk through the code and indent it neatly (if you haven't already) and you should find where the problem lies.

fototex

8:44 am on Jul 12, 2009 (gmt 0)

10+ Year Member



I'we walked through the code very carefully and inserted my
<%End if%> under the table:

<td valign="top" class="blacktext" background="BGS/Gray.jpg">
<STRONG><font face="Arial" size="2"> We wish you a great year</font></STRONG>
</td>
</tr>
</table>

<%End if%>

And that worked. Now the comparison works also for the given e-mails.

Thank you very much.