Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vbscript functions (help!!) 1

Status
Not open for further replies.

boab

Programmer
May 30, 2001
75
GB
Hi guys have a bit of a problem. I'm currently working on a website using asp to generate page on the fly however the functions whichI am using in vbscript will not work. The error message that is being returned is that the server was expecting the 'End' statement however the 'End Function' statement is already there. Predictably enough when I remove the word function the error is that the word function was expected, any Ideas? thanx
 
can you please post the function code. Mise Le Meas,

Mighty :)
 
Hi here is the source code the reason that I did it this way is that it was the easiest way I could think of to populate the text field if there was an error in the registration if there is a more elegeant way of doing this (and one that requires less typing!!) I would be grateful.


<%Language vbscript%>
<%
dim usr, name1, name2, add1, add2, post, email, Pass1, pass2,init
dim alerter
set usr =request(&quot;usr&quot;)
set name1 = request(&quot;name1&quot;)
set name2 = request(&quot;name2&quot;)
set add1 = request(&quot;addr1&quot;)
set add2 = request(&quot;addr2&quot;)
set post = request(&quot;post&quot;)
set email = request(&quot;email&quot;)
set pass1 = request(&quot;pass1&quot;)
set pass2 = request(&quot;pass2&quot;)
set init= request(&quot;initials&quot;)

dim con, rst, sql
set sql = &quot;Select * From PublicMembers WHERE usr=&quot;&usr
set con = Server.CreateObject(&quot;ADODB.Connection&quot;)
call con.open(&quot;COED_DSN&quot;,&quot;BoabFett&quot;,&quot;noddy1&quot;)
set rst = Server.CreateObject(&quot;ADODB.Recordset&quot;)

If (eChk(email)<>1)Then
set alerter = emal
alerter(alerter)
else if((pass1<>pass2)Or(pass1=&quot;&quot;)) Then
set alerter = pas
alerter(alerter)
else
call rst.open(sql, con,adOpenStatic, adLockOptomistic, adCmdText)
dim chqkr
set chqkr=rst(&quot;name1&quot;)

If(chqkr=null)Then
Call rst.AddNew()
rst(&quot;usr&quot;)=usr
rst(&quot;nam1&quot;)=name1
rst(&quot;nam2&quot;)=name2
rst(&quot;init&quot;)=init
rst(&quot;addr1&quot;)=add1
rst(&quot;addr2&quot;)=add2
rst(&quot;post&quot;)=post
rst(&quot;email&quot;)=email
rst(&quot;pass&quot;)=pass1
Call rst.Update()
Call rst.MoveLast()
else
set alerter = userr
alerter(alerter)






Function Renter(usr, name1, name2, add1, add2, post, email, Pass1, pass2)
response.write(&quot;<html>&quot;)
response.write(&quot;<head>&quot;)
response.write(&quot;<title>Untitled Document</title>&quot;)
response.write(&quot; <meta http-equiv=&quot;&quot; &&quot;Content-Type&quot;&quot; &&quot; content=&quot;&quot; &&quot;text/html; charset=iso-8859-1&quot;&quot; &&quot;>&quot;)
response.write(&quot;</head>&quot;)

response.write(&quot; <body bgcolor=&quot;&quot; &&quot;#000099&quot;&quot; &&quot; text=&quot;&quot; &&quot;#00CCFF&quot;&quot; & &quot;background=&quot;&quot; &&quot;../1163k5Edinburgh.gif&quot;&quot; &&quot;>&quot;)
response.write(&quot; <div align=&quot; center &quot;>&quot;)
response.write(&quot; <p><font size=&quot; 5 &quot; ><b><u><i><font size=&quot; 7 &quot; >C</font></i>ity of <i> <font size=&quot; 7 &quot;>E</font></i>dinburgh &quot;)
response.write(&quot; <i><font size=&quot; & 7 &quot;>M</font></i>essage <font size=&quot; 7 &quot;> <i>B</i></font>oard <i><font size= &quot; 7 &quot;>R</font></i>egistration &quot;)
response.write(&quot; </u></b></font></p>&quot;)
response.write(&quot; <form name=&quot; form1 &quot; method=&quot; post &quot; action= &quot; regcheck.asp &quot; >&quot;)
response.write(&quot; <table width=&quot;&quot; &&quot;50%&quot;&quot; &&quot; border=&quot;&quot; &&quot;0&quot;&quot; &&quot;>&quot;)
response.write(&quot; <tr>&quot;)
response.write(&quot; <td width='32%'>User Name</td>&quot;)
response.write(&quot; <td width='68%'>&quot;)
response.write(&quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;usr&quot;&quot; &&quot; value=&quot; & usr &&quot;>&quot;)
response.write(&quot; </td>&quot;)
response.write(&quot; </tr>&quot;)
response.write(&quot; <tr>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>First Name</td>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;)
response.write(&quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;name1&quot;&quot; &&quot; value=&quot;& name1 &&quot;>&quot;)
response.write(&quot; </td>&quot;)
response.write(&quot; </tr>&quot;)
response.write(&quot; <tr>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>Initials</td>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;)
response.write(&quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;inits&quot;&quot; &&quot; value=>&quot;)
response.write(&quot; </td>&quot;)
response.write(&quot; </tr>&quot;)
response.write(&quot; <tr>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>Second Name</td>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;)
response.write(&quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;name2&quot;&quot; &&quot; value=&quot; &name2&&quot;>&quot;)
response.write(&quot; </td>&quot;)
response.write(&quot; </tr>&quot;)
response.write(&quot; <tr>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>Address 1</td>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;)
response.write(&quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;addr1&quot;&quot; &&quot; value=&quot;&add1&&quot;>&quot;)
response.write(&quot; </td>&quot;)
response.write(&quot; </tr>&quot;)
response.write(&quot; <tr>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>Address 2</td>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;)
response.write(&quot; <input type=&quot; text &quot; name=&quot; addr2 quot value=&quot; add2 &quot;>&quot;)
response.write(&quot; </td>&quot;)
response.write(&quot; </tr>&quot;)
response.write(&quot; <tr>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>Post/Zip Code</td>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;)
response.write(&quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;postcd&quot;&quot; &&quot; value=&quot;&post&&quot;>&quot;)
response.write(&quot; </td>&quot;)
response.write(&quot; </tr>&quot;)
response.write(&quot; <tr>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>E-mail</td>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;)
response.write(&quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;email&quot;&quot; &&quot; value=&quot;&email&&quot;>&quot;)
response.write(&quot; </td>&quot;)
response.write(&quot; </tr>&quot;)
response.write(&quot; <tr>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>PassWord</td>&quot;)
response.write(&quot; <td width=&quot;&quot;68%&quot;&quot; &&quot;> &quot;)
response.write(&quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;pass1&quot;&quot; &&quot;value=&quot;&pass1&&quot;>&quot;)
response.write(&quot; </td>&quot;)
response.write(&quot; </tr>&quot;)
response.write(&quot; <tr>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>Confirm Password</td>&quot;)
response.write(&quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;)
response.write(&quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;pass2&quot;&quot; &&quot;value=&quot;&pass2&&quot;>&quot;)
response.write(&quot; </td>&quot;)
response.write(&quot; </tr>&quot;)
response.write(&quot; </table>&quot;)
response.write(&quot; </form>&quot;)
response.write(&quot; </div>&quot;)
response.write(&quot;</body>&quot;)
response.write(&quot;</html>&quot;) End Function


%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<script language=&quot;javascript&quot;>
<!--

function alerter(val)
if (val='emal'){
alert(&quot;Sorry the email address you entered is not valid&quot;);
email=&quot;&quot;;
Renter(usr, name1, name2, add1, add2, post, email, Pass1, pass2)
}
else if(val='pas'){
alert(&quot;Sorry but the two passwords you entered do not match&quot;);
pass1=&quot;&quot;;
pass2=&quot;&quot;;
Renter(usr, name1, name2, add1, add2, post, email, Pass1, pass2)
}else {
alert(&quot;Sorry but the User name you have choosen is already taken please choose another&quot;);
usr=&quot;&quot;;
Renter(usr, name1, name2, add1, add2, post, email, Pass1, pass2)
}
}
function eChk(email) {
var L = email.length;
for(var i=0;i<=L;i++){
if(email.charAt(i)=='@') {
var dot1 = email.charAt(email.length-6)
var dot2 = email.charAt(email.length-4)
if (dot1=='.') {
var sub1 = email.substring(email.length-6,email.length)
if (sub1=='co.uk') {
return 1;
break;
} else {
return 0;
break;
}

}else if(dot2='.'){
var sub2 =email.substring(email.length-4,email.length)
if((sub1=='com')||(sub1=='org')||(sub1=='net')) {
return 1;
break;
}else{
return 0;
break;
}
}
}else{
return 0;
break;
}
}

}

-->
</script>

</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>

</body>
</html>
 
It looks like maybe the system thinks your &quot;End Function&quot; is just part of your final Response.Write. I've seen this myself a couple of times. What I would do is go to the end of the last response.write statement and hit enter. Hopefully, this might work. Mise Le Meas,

Mighty :)
 
I have tried that and just get the same response
 
I'm grasping at straws here but try leaving out the parentheses on the response.write statements. I personnally never use parentheses. (you must leave a space between the write and the operning quotes)
i.e.

Function Renter(usr, name1, name2, add1, add2, post, email, Pass1, pass2)
response.write &quot;<html>&quot;
response.write &quot;<head>&quot;
.
.
.
response.write &quot;</body>&quot;
response.write &quot;</html>&quot;
End Function





Mise Le Meas,

Mighty :)
 
The page now reads

<%Language vbscript%>
<%
dim usr, name1, name2, add1, add2, post, email, Pass1, pass2,init
dim alerter
set usr =request(&quot;usr&quot;)
set name1 = request(&quot;name1&quot;)
set name2 = request(&quot;name2&quot;)
set add1 = request(&quot;addr1&quot;)
set add2 = request(&quot;addr2&quot;)
set post = request(&quot;post&quot;)
set email = request(&quot;email&quot;)
set pass1 = request(&quot;pass1&quot;)
set pass2 = request(&quot;pass2&quot;)
set init= request(&quot;initials&quot;)

dim con, rst, sql
set sql = &quot;Select * From PublicMembers WHERE usr=&quot;&usr
set con = Server.CreateObject(&quot;ADODB.Connection&quot;)
call con.open(&quot;COED_DSN&quot;,&quot;BoabFett&quot;,&quot;noddy1&quot;)
set rst = Server.CreateObject(&quot;ADODB.Recordset&quot;)

If (eChk(email)<>1)Then
set alerter = emal
alerter(alerter)
else if((pass1<>pass2)Or(pass1=&quot;&quot;)) Then
set alerter = pas
alerter(alerter)
else
call rst.open(sql, con,adOpenStatic, adLockOptomistic, adCmdText)
dim chqkr
set chqkr=rst(&quot;name1&quot;)

If(chqkr=null)Then
Call rst.AddNew()
rst(&quot;usr&quot;)=usr
rst(&quot;nam1&quot;)=name1
rst(&quot;nam2&quot;)=name2
rst(&quot;init&quot;)=init
rst(&quot;addr1&quot;)=add1
rst(&quot;addr2&quot;)=add2
rst(&quot;post&quot;)=post
rst(&quot;email&quot;)=email
rst(&quot;pass&quot;)=pass1
Call rst.Update()
Call rst.MoveLast()
else
set alerter = userr
alerter(alerter)






Function Renter(usr, name1, name2, add1, add2, post, email, Pass1, pass2)
response.write &quot;<html>&quot;
response.write &quot;<head>&quot;
response.write &quot;<title>Untitled Document</title>&quot;
response.write &quot; <meta http-equiv=&quot;&quot &&quot;Content-Type&quot;&quot &&quot; content=&quot;&quot &&quot;text/html; charset=iso-8859-1&quot;&quot &&quot;>&quot;
response.write &quot;</head>&quot;

response.write &quot; <body bgcolor=&quot;&quot &&quot;#000099&quot;&quot &&quot; text=&quot;&quot &&quot;#00CCFF&quot;&quot & &quot;background=&quot;&quot &&quot;../1163k5Edinburgh.gif&quot;&quot &&quot;>&quot;
response.write &quot; <div align=&quot center &quot>&quot;
response.write &quot; <p><font size=&quot 5 &quot ><b><u><i><font size=&quot 7 &quot >C</font></i>ity of <i> <font size=&quot 7 &quot>E</font></i>dinburgh &quot;
response.write &quot; <i><font size=&quot & 7 &quot>M</font></i>essage <font size=&quot 7 &quot> <i>B</i></font>oard <i><font size= &quot 7 &quot>R</font></i>egistration &quot;
response.write &quot; </u></b></font></p>&quot;
response.write &quot; <form name=&quot form1 &quot method=&quot post &quot action= &quot regcheck.asp &quot >&quot;
response.write &quot; <table width=&quot;&quot &&quot;50%&quot;&quot &&quot; border=&quot;&quot &&quot;0&quot;&quot &&quot;>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width='32%'>User Name</td>&quot;
response.write &quot; <td width='68%'>&quot;
response.write &quot; <input type=&quot;&quot &&quot;text&quot;&quot &&quot; name=&quot;&quot &&quot;usr&quot;&quot &&quot; value=&quot; & usr &&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot &&quot;32%&quot;&quot &&quot;>First Name</td>&quot;
response.write &quot; <td width=&quot;&quot &&quot;68%&quot;&quot &&quot;> &quot;
response.write &quot; <input type=&quot;&quot &&quot;text&quot;&quot &&quot; name=&quot;&quot &&quot;name1&quot;&quot &&quot; value=&quot;& name1 &&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot &&quot;32%&quot;&quot &&quot;>Initials</td>&quot;
response.write &quot; <td width=&quot;&quot &&quot;68%&quot;&quot &&quot;> &quot;
response.write &quot; <input type=&quot;&quot &&quot;text&quot;&quot &&quot; name=&quot;&quot &&quot;inits&quot;&quot &&quot; value=>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot &&quot;32%&quot;&quot &&quot;>Second Name</td>&quot;
response.write &quot; <td width=&quot;&quot &&quot;68%&quot;&quot &&quot;> &quot;
response.write &quot; <input type=&quot;&quot &&quot;text&quot;&quot &&quot; name=&quot;&quot &&quot;name2&quot;&quot &&quot; value=&quot; &name2&&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot &&quot;32%&quot;&quot &&quot;>Address 1</td>&quot;
response.write &quot; <td width=&quot;&quot &&quot;68%&quot;&quot &&quot;> &quot;
response.write &quot; <input type=&quot;&quot &&quot;text&quot;&quot &&quot; name=&quot;&quot &&quot;addr1&quot;&quot &&quot; value=&quot;&add1&&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot &&quot;32%&quot;&quot &&quot;>Address 2</td>&quot;
response.write &quot; <td width=&quot;&quot &&quot;68%&quot;&quot &&quot;> &quot;
response.write &quot; <input type=&quot text &quot name=&quot addr2 quot value=&quot add2 &quot>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot &&quot;32%&quot;&quot &&quot;>Post/Zip Code</td>&quot;
response.write &quot; <td width=&quot;&quot &&quot;68%&quot;&quot &&quot;> &quot;
response.write &quot; <input type=&quot;&quot &&quot;text&quot;&quot &&quot; name=&quot;&quot &&quot;postcd&quot;&quot &&quot; value=&quot;&post&&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot &&quot;32%&quot;&quot &&quot;>E-mail</td>&quot;
response.write &quot; <td width=&quot;&quot &&quot;68%&quot;&quot &&quot;> &quot;
response.write &quot; <input type=&quot;&quot &&quot;text&quot;&quot &&quot; name=&quot;&quot &&quot;email&quot;&quot &&quot; value=&quot;&email&&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot &&quot;32%&quot;&quot &&quot;>PassWord</td>&quot;
response.write &quot; <td width=&quot;&quot;68%&quot;&quot &&quot;> &quot;
response.write &quot; <input type=&quot;&quot &&quot;text&quot;&quot &&quot; name=&quot;&quot &&quot;pass1&quot;&quot &&quot;value=&quot;&pass1&&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot &&quot;32%&quot;&quot &&quot;>Confirm Password</td>&quot;
response.write &quot; <td width=&quot;&quot &&quot;68%&quot;&quot &&quot;> &quot;
response.write &quot; <input type=&quot;&quot &&quot;text&quot;&quot &&quot; name=&quot;&quot &&quot;pass2&quot;&quot &&quot;value=&quot;&pass2&&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; </table>&quot;
response.write &quot; </form>&quot;
response.write &quot; </div>&quot;
response.write &quot;</body>&quot;
response.write &quot;</html>&quot;
End Function


%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<script language=&quot;javascript&quot;>
<!--

function alerter(val)
if (val='emal'){
alert(&quot;Sorry the email address you entered is not valid&quot;);
email=&quot;&quot;;
Renter(usr, name1, name2, add1, add2, post, email, Pass1, pass2)
}
else if(val='pas'){
alert(&quot;Sorry but the two passwords you entered do not match&quot;);
pass1=&quot;&quot;;
pass2=&quot;&quot;;
Renter(usr, name1, name2, add1, add2, post, email, Pass1, pass2)
}else {
alert(&quot;Sorry but the User name you have choosen is already taken please choose another&quot;);
usr=&quot;&quot;;
Renter(usr, name1, name2, add1, add2, post, email, Pass1, pass2)
}
}
function eChk(email) {
var L = email.length;
for(var i=0;i<=L;i++){
if(email.charAt(i)=='@') {
var dot1 = email.charAt(email.length-6)
var dot2 = email.charAt(email.length-4)
if (dot1=='.') {
var sub1 = email.substring(email.length-6,email.length)
if (sub1=='co.uk') {
return 1;
break;
} else {
return 0;
break;
}

}else if(dot2='.'){
var sub2 =email.substring(email.length-4,email.length)
if((sub1=='com')||(sub1=='org')||(sub1=='net')) {
return 1;
break;
}else{
return 0;
break;
}
}
}else{
return 0;
break;
}
}

}

-->
</script>

</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>

</body>
</html>

and I am still getting the same message from the server could this be a problem with the server I am running pws4 on win 98 this is driving me X-)(nuts)
 
It seems to me that you have forgot to end two of your If-statements. Above
Code:
Function Renter
, add the following:
Code:
     End If
  End If


That will close the statments:
Code:
     If (eChk(email)<>1)Then
and
Code:
     If(chqkr=null)Then


Hope this helps,
Palooka
 


It appears you are missing the &quot;End If&quot; just before the function.

Fengshui_1998
 
Has anybody noticed that he uses
else if
instead of elseif
Code:
If ......
else if .....
else 
should be
if ..........
else
    if ..........
    else .....
    end if
End if
OR
If .....
elseif .....
else ......
endif
 
Right Guys I have added the endif s(I feel so stupid about that:)) and the code reads:
<%Language vbscript%>
<%
dim usr, name1, name2, add1, add2, post, email, Pass1, pass2,init
dim alerter
set usr =request(&quot;usr&quot;)
set name1 = request(&quot;name1&quot;)
set name2 = request(&quot;name2&quot;)
set add1 = request(&quot;addr1&quot;)
set add2 = request(&quot;addr2&quot;)
set post = request(&quot;post&quot;)
set email = request(&quot;email&quot;)
set pass1 = request(&quot;pass1&quot;)
set pass2 = request(&quot;pass2&quot;)
set init= request(&quot;initials&quot;)

dim con, rst, sql
set sql = &quot;Select * From PublicMembers WHERE usr=&quot;&usr
set con = Server.CreateObject(&quot;ADODB.Connection&quot;)
call con.open(&quot;COED_DSN&quot;,&quot;BoabFett&quot;,&quot;noddy1&quot;)
set rst = Server.CreateObject(&quot;ADODB.Recordset&quot;)

If (eChk(email)<>1)Then
set alerter = emal
alerter(alerter)
else if((pass1<>pass2)Or(pass1=&quot;&quot;)) Then
set alerter = pas
alerter(alerter)
else
call rst.open(sql, con,adOpenStatic, adLockOptomistic, adCmdText)
dim chqkr
set chqkr=rst(&quot;name1&quot;)

If(chqkr=null)Then
Call rst.AddNew()
rst(&quot;usr&quot;)=usr
rst(&quot;nam1&quot;)=name1
rst(&quot;nam2&quot;)=name2
rst(&quot;init&quot;)=init
rst(&quot;addr1&quot;)=add1
rst(&quot;addr2&quot;)=add2
rst(&quot;post&quot;)=post
rst(&quot;email&quot;)=email
rst(&quot;pass&quot;)=pass1
Call rst.Update()
Call rst.MoveLast()
else
set alerter = userr
alerter(alerter)
End If
End If





Function Renter(usr, name1, name2, add1, add2, post, email, Pass1, pass2)
response.write &quot;<html>&quot;
response.write &quot;<head>&quot;
response.write &quot;<title>Untitled Document</title>&quot;
response.write &quot; <meta http-equiv=&quot;&quot; &&quot;Content-Type&quot;&quot; &&quot; content=&quot;&quot; &&quot;text/html; charset=iso-8859-1&quot;&quot; &&quot;>&quot;
response.write &quot;</head>&quot;

response.write &quot; <body bgcolor=&quot;&quot; &&quot;#000099&quot;&quot; &&quot; text=&quot;&quot; &&quot;#00CCFF&quot;&quot; & &quot;background=&quot;&quot; &&quot;../1163k5Edinburgh.gif&quot;&quot; &&quot;>&quot;
response.write &quot; <div align=&quot; center &quot;>&quot;
response.write &quot; <p><font size=&quot; 5 &quot; ><b><u><i><font size=&quot; 7 &quot; >C</font></i>ity of <i> <font size=&quot; 7 &quot;>E</font></i>dinburgh &quot;
response.write &quot; <i><font size=&quot; & 7 &quot;>M</font></i>essage <font size=&quot; 7 &quot;> <i>B</i></font>oard <i><font size= &quot; 7 &quot;>R</font></i>egistration &quot;
response.write &quot; </u></b></font></p>&quot;
response.write &quot; <form name=&quot; form1 &quot; method=&quot; post &quot; action= &quot; regcheck.asp &quot; >&quot;
response.write &quot; <table width=&quot;&quot; &&quot;50%&quot;&quot; &&quot; border=&quot;&quot; &&quot;0&quot;&quot; &&quot;>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width='32%'>User Name</td>&quot;
response.write &quot; <td width='68%'>&quot;
response.write &quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;usr&quot;&quot; &&quot; value=&quot; & usr &&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>First Name</td>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;
response.write &quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;name1&quot;&quot; &&quot; value=&quot;& name1 &&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>Initials</td>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;
response.write &quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;inits&quot;&quot; &&quot; value=>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>Second Name</td>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;
response.write &quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;name2&quot;&quot; &&quot; value=&quot; &name2&&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>Address 1</td>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;
response.write &quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;addr1&quot;&quot; &&quot; value=&quot;&add1&&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>Address 2</td>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;
response.write &quot; <input type=&quot; text &quot; name=&quot; addr2 quot value=&quot; add2 &quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>Post/Zip Code</td>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;
response.write &quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;postcd&quot;&quot; &&quot; value=&quot;&post&&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>E-mail</td>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;
response.write &quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;email&quot;&quot; &&quot; value=&quot;&email&&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>PassWord</td>&quot;
response.write &quot; <td width=&quot;&quot;68%&quot;&quot; &&quot;> &quot;
response.write &quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;pass1&quot;&quot; &&quot;value=&quot;&pass1&&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; <tr>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;32%&quot;&quot; &&quot;>Confirm Password</td>&quot;
response.write &quot; <td width=&quot;&quot; &&quot;68%&quot;&quot; &&quot;> &quot;
response.write &quot; <input type=&quot;&quot; &&quot;text&quot;&quot; &&quot; name=&quot;&quot; &&quot;pass2&quot;&quot; &&quot;value=&quot;&pass2&&quot;>&quot;
response.write &quot; </td>&quot;
response.write &quot; </tr>&quot;
response.write &quot; </table>&quot;
response.write &quot; </form>&quot;
response.write &quot; </div>&quot;
response.write &quot;</body>&quot;
response.write &quot;</html>&quot;
EndFunction


%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<script language=&quot;javascript&quot;>
<!--

function alerter(val)
if (val='emal'){
alert(&quot;Sorry the email address you entered is not valid&quot;);
email=&quot;&quot;;
Renter(usr, name1, name2, add1, add2, post, email, Pass1, pass2)
}
else if(val='pas'){
alert(&quot;Sorry but the two passwords you entered do not match&quot;);
pass1=&quot;&quot;;
pass2=&quot;&quot;;
Renter(usr, name1, name2, add1, add2, post, email, Pass1, pass2)
}else {
alert(&quot;Sorry but the User name you have choosen is already taken please choose another&quot;);
usr=&quot;&quot;;
Renter(usr, name1, name2, add1, add2, post, email, Pass1, pass2)
}
}
function eChk(email) {
var L = email.length;
for(var i=0;i<=L;i++){
if(email.charAt(i)=='@') {
var dot1 = email.charAt(email.length-6)
var dot2 = email.charAt(email.length-4)
if (dot1=='.') {
var sub1 = email.substring(email.length-6,email.length)
if (sub1=='co.uk') {
return 1;
break;
} else {
return 0;
break;
}

}else if(dot2='.'){
var sub2 =email.substring(email.length-4,email.length)
if((sub1=='com')||(sub1=='org')||(sub1=='net')) {
return 1;
break;
}else{
return 0;
break;
}
}
}else{
return 0;
break;
}
}

}

-->
</script>

</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>

</body>
</html>
but I still get the error as below

Microsoft VBScript compilation error '800a03f6'

Expected 'End'

/sgcpb/Members/regcheck.asp, line 135
 
That's probably because of the reason JohnYingling mentioned above.

Use
Code:
ElseIf
instead of
Code:
Else If

/Palooka
 
done that & now I'm getting the message below

Microsoft VBScript compilation error '800a0400'

Expected statement

/sgcpb/Members/regcheck.asp, line 49

EndIf
^

Also I have another thread under the title of String variants Can some body have a look at it please:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top