Hi!
Could someone please help me with this script I am trying out? It is supposed to validation the format of an e-mail address entered but it doesn't work and you can still register an account by having anything as ur e-mail address.
Here is the script:
.............................................................................................
<%
'Save entered username and password
uid = Request.Form("uid")
pass = Request.Form("pass")
full = Request.Form("full")
Email = Request.Form("email")
ip = Request.Form("ip")
if uid = "" then Response.redirect("empty.asp")
if pass = "" then Response.Redirect("empty.asp")
if full = "" then Response.Redirect("empty.asp")
if Email = "" then Response.Redirect("empty.asp")
Dim checkemail
checkemail = 0 'Initializing checkemail to 0
'if the len is less than 5 then it can't be an email
'(i.e.: a@a.c)
If Len(session("email")) <= 5 Then
checkemail = 1
End If
If InStr(1, session("email"), "@", 1) < 2 Then
'If we find one and only one @, then the
'email address is good to go.
checkemail = 1
Else
If InStr(1,session("email"), ".", 1) < 4 Then
'Must have a '.' too
checkemail = 1
End If
End If
If checkemail <> 0 then
'Well , if checkemail <> 0 then something
'must be wrong
response.write "Bad E-Mail..."
End If
'Build connection
set conn = server.CreateObject ("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\home\Default\zoebirkett.net\htdocs\cgi-bin\pro.mdb"
set rs = server.CreateObject ("ADODB.Recordset")
'Open all records
rs.Open "SELECT * FROM admin", conn, 3, 3
'Check if username doesn't already exist
do while not rs.EOF
if rs("uid")=uid then
set rs=nothing
set conn=nothing
Response.Redirect("taken.asp")
end if
rs.MoveNext
loop
'Add a record
rs.AddNew
'Put username and password in record
rs("uid")=uid
rs("pass")=pass
rs("full")=full
rs("email")=email
rs("ip")=ip
'Save record
rs.Update
set rs=nothing
set conn=nothing
Response.Redirect("login.asp")
%>
.............................................................................................
I really appreciate any help anyone can give me!
Thanks,
Vicky
xxx