Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: RES: Re: RES: Checking User


Message #1 by "Elildo Mancebo Reis" <lists@a...> on Wed, 19 Mar 2003 11:48:02 -0300
There are some good scripts (JavaScripts) to test it, but it's good to test
on ACTION page too (as some people may want to write a form to include
records in your DB.

A simple check in ASP is
if InStrRev(email, "@") 0 then
   ... fail
end if

You can even test if "@" is not the last character...
If right(email,1) = "@"
   ... fail
end if

Elildo Mancebo Reis
elildo@a...
www.aspecto.net

-----Mensagem original-----
De: Andy [mailto:andy@t...]
Enviada em: quarta-feira, 19 de março de 2003 11:38
Para: ASP Web HowTo
Assunto: [asp_web_howto] Re: RES: Checking User


Hello ,

That works!!! Thanks....:-)

How can I check if the user has enter a valid email address with the "@"
sign ?

Thanks


Andy
----- Original Message -----
From: "Elildo Mancebo Reis" <lists@a...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Wednesday, March 19, 2003 10:28 PM
Subject: [asp_web_howto] RES: Checking User


> Just use...
> if Username = "" then
>    ...
> end if
>
> It would be good...
> if len(trim(username)) = 0 then
>
> Elildo Mancebo Reis
> elildo@a...
> www.aspecto.net
>
> -----Mensagem original-----
> De: Andy [mailto:andy@t...]
> Enviada em: quarta-feira, 19 de março de 2003 11:20
> Para: ASP Web HowTo
> Assunto: [asp_web_howto] Checking User
>
>
> Hello,
>
> I have an asp page which allow user to create an account.When the form is
> submited, I perform some checking on the username field, if the username
> field is empty , it will return an error message but it seems not be
> working.Below is my code :
>
> 'Save entered username and password
>  Username = Request.Form("txtUsername")
>  Password = Request.Form("txtPassword")
>  Fullname = Request.Form("txtFullname")
>  Email = Request.Form("txtEmail")
>
>  If Username = " " Then
>   Response.Redirect "signup.asp?loginname=failed"
>  End If
>
>
> Hope someone might guide me through.
>
>
> Thanks.
>
>
> Andy
>
>
> %%email.unsub%%
>
>
>
>


%%email.unsub%%

Message #2 by "Elildo Mancebo Reis" <lists@a...> on Wed, 19 Mar 2003 12:03:20 -0300
And you also can check if there is at least one "." after the "@"

Step by step...

p = InStrRev(email,"@")
if p > 0 then 'valid
  if InStrRev(Mid(email,p+3),".") > 0 then 'valid
     ' I used p+3 because there is no domain name shorter than 2 characters
(username@a...)
  else
     ... invalid
  end if
else
  ... invalid
end if

Elildo Mancebo Reis
elildo@a...
www.aspecto.net

-----Mensagem original-----
De: Andy [mailto:andy@t...]
Enviada em: quarta-feira, 19 de março de 2003 11:38
Para: ASP Web HowTo
Assunto: [asp_web_howto] Re: RES: Checking User


Hello ,

That works!!! Thanks....:-)

How can I check if the user has enter a valid email address with the "@"
sign ?

Thanks


Andy
----- Original Message -----
From: "Elildo Mancebo Reis" <lists@a...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Wednesday, March 19, 2003 10:28 PM
Subject: [asp_web_howto] RES: Checking User


> Just use...
> if Username = "" then
>    ...
> end if
>
> It would be good...
> if len(trim(username)) = 0 then
>
> Elildo Mancebo Reis
> elildo@a...
> www.aspecto.net
>
> -----Mensagem original-----
> De: Andy [mailto:andy@t...]
> Enviada em: quarta-feira, 19 de março de 2003 11:20
> Para: ASP Web HowTo
> Assunto: [asp_web_howto] Checking User
>
>
> Hello,
>
> I have an asp page which allow user to create an account.When the form is
> submited, I perform some checking on the username field, if the username
> field is empty , it will return an error message but it seems not be
> working.Below is my code :
>
> 'Save entered username and password
>  Username = Request.Form("txtUsername")
>  Password = Request.Form("txtPassword")
>  Fullname = Request.Form("txtFullname")
>  Email = Request.Form("txtEmail")
>
>  If Username = " " Then
>   Response.Redirect "signup.asp?loginname=failed"
>  End If
>
>
> Hope someone might guide me through.
>
>
> Thanks.
>
>
> Andy
>
>
> %%email.unsub%%
>
>
>
>


%%email.unsub%%


  Return to Index