Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Check Domain -> Email Address

Quote Reply
Check Domain -> Email Address
Okay...I've added this small code hack into my signup account script(powered by Links v.1.13:

In Reply To:

if ($email) {
if ($email !~ /.+\@.+\..+/) {
$email_error .= "$CUSTOM{warn_img} The format of your <span class=\"boldredtext\">email address</span> is incorrect.
";
}
else {
($account,$domain) = (split /\@/, $email);
$checkdomain = qq|http://$domain|;
$CUSTOM{ua} = new LWP::UserAgent;
$CUSTOM{ua}->agent("UrlScope/8.0");
$CUSTOM{ua}->timeout(30); # in seconds
$CUSTOM{req} = new HTTP::Request 'GET' => ($checkdomain);
$CUSTOM{res} = $CUSTOM{ua}->request($CUSTOM{req});
if ($CUSTOM{res}->is_error) {
$email_error .= "$CUSTOM{warn_img} The email address you submitted is not active or no longer in service. Please select another email address.
";

}
}
}


BTW: $email is defined above in the sub as my $email = $in->param('Email');.

And later on in the sub, I have the following error check codes:

Code:

if (($country_error) or ($contact_error) or ($email_error) or ($eperm_error) or ($userperm_error) or ($sendemailperm_error) or ($newsperm_error) or ($username_error) or ($pword_error) or ($pword2_error)) {
my $title_linked = &build_linked_members_title ("Register Account/Error: Unable to Process Form");
&site_html_signup_form ( {error => "The following errors occurred when you tried to fill out this form.", country_error => $country_error, contact_error => $contact_error, email_error => $email_error, eperm_error => $eperm_error, userperm_error => $userperm_error, sendemailperm_error => $sendemailperm_error, newsperm_error => $newsperm_error, username_error => $username_error, pword_error => $pword_error, pword2_error => $pword2_error, username => $username, author => $author, password => $password, password2 => $password2, email => $email, email_permission => $email_permission, username_permission => $username_permission, send_permission => $send_permission, newsletter_permission => $newsletter_permission, country => $country_select, state => $state_select, city => $city, address => $address, zipcode => $zipcode, telephone => $telephone, fax => $fax, hobbies => $hobbies, research_interests => $resint, signature => $signature, title_linked => $title_linked}, $dynamic );
return;
}
else {
my $title_linked = &build_linked_members_title ("Register Account/Confirmation Screen");
&site_html_signup_confirm ( {username => $username, author => $author, password => $password, email => $email, email_permission => $email_perm, username_permission => $user_perm, send_permission => $send_perm, Country => $country, State => $state, city => $city, address => $address, zipcode => $zipcode, telephone => $telephone, fax => $fax, hobbies => $hobbies, research_interests => $resint, signature => $signature, newsletter_permission => $news_perm, title_linked => $title_linked}, $in, $dynamic );
return;
}


Notice the bolded codes above...

The code hack works for the most part...it will only allow "
active" domains to be entered in the Email field. However, the error message that appears is the following:

Code:

Content-type: text/html

Software error:

DBSQL (25342): Fatal Error: Unable to load the DBI module: 'Can't connect to fkladfnlkdf.com:80 (Bad hostname 'fkladfnlkdf.com')' at /mnt/web/guide/anthrotech/members/bin/signup.cgi line 265

For help, please send mail to the webmaster (Webmaster), giving this error message and the time and date of the error.


Line 265 is the following:

Code:

my $user_r = $USERDB->get_user_record ($username, 'HASH');


BTW: I've added another sub in the DBSQL file that gets records based on Username than the PRIMARY KEY, which is UserID....

If anyone sees something I am missing, please let me know.

Thanks in advance.

Regards,

Eliot Lee
Subject Author Views Date
Thread Check Domain -> Email Address Stealth 4072 Jul 8, 2001, 8:26 PM
Thread Re: Check Domain -> Email Address
Paul 3974 Jul 9, 2001, 5:02 AM
Post Re: Check Domain -> Email Address
Stealth 3963 Jul 9, 2001, 8:09 AM