On Sunday, May 12, 2002, at 06:13 , Bill Lyles wrote:
[..]
> Everytime I run the form it keeps telling me to enter a valid email 
> address
> wich of course is my own for testing
>
> Please tell me whats wrong
>
> $message = "" ;
> $found_err = "" ;
>
> $errmsg = "<p>Please enter a valid email address</p>\n" ;
>
> if ($email !~ /.+\@.+\..+/) {
>  $message = $message.$errmsg ;
>  $found_err = 1 ; }
>
> if ($found_err) {
>  &PrintError; }
>
> This is the script that gets the data from the form
>
[..]

the function you wrote seems kosher, the questions then
go back to how are you protecting the above from being
called when your cgi gets kicked up? May I suggest say:

  sub checkEmailAddr {
        my ($email) = @_;
        my  $message = "" ;
        my $found_err = "" ;

        my $errmsg = "<p>Please enter a valid email address</p>\n" ;

        if ($email !~ /.+\@.+\..+/) {
                 $message = $message.$errmsg ;
                $found_err = 1 ; }

        if ($found_err) {
                print "problems with $email\n\t$message";
        }else {
                print "$email Seems OK\n";
        }

  } # end of checkEmailAddr

At which point that chuck of code is not invoked until
you call it out... hence pass in the address to check.

for test purposes I ran

        my @list = [EMAIL PROTECTED] [EMAIL PROTECTED]
                [EMAIL PROTECTED] bob/;

        foreach my $addr ( @list) {     checkEmailAddr($addr); }

and it woofed on only bob....




ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to