in reply to Newbie needs help with email CGI script
Your regex for testing for a valid e-mail address does not work. Below is a snippet explaining the use of Email::Valid. Email::Valid cannot catch all valid e-mail addresses as RFC822 allows for arbitrarily nested comments in e-mail addresses, but will probably correctly identify 99% or more of the e-mail addresses submitted.
Additionally, I noticed that you are not consistently checking the return calls on your open statements. If one fails to open, your script will silently continue and you won't know why.#!/usr/bin/perl -wT use strict; use CGI; use Email::Valid; my $cgi = CGI-new(); my $email = $cgi->param( 'visitors_email_address' ); my $password = $cgi->param( 'visitor_password' ); my $valid_address = Email::Valid->address( $e-mail ); if ( $valid_address ) { # Address is valid, do stuff here # This DOES NOT mean that the address is real } else { # Address is invalid. }
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just go the the link and check out our stats.
|
|---|