osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 
 

Email validation issue

This is a discussion on Email validation issue within the osCommerce 2.2 Installation Help forums, part of the osCommerce 2.2 Forums category; Trying to test the site for registration of a customer and I'm having a problem with email valifdation. The error ...


Go Back   osCommerce and osCMax shopping cart software forums > osCommerce 2.2 Forums > osCommerce 2.2 Installation Help

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 06-24-2004, 11:20 AM
Lurker
 
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
webguy262
Default Email validation issue

Trying to test the site for registration of a customer and I'm having a problem with email valifdation.

The error I'm getting on the form is...

"Your E-Mail Address does not appear to be valid - please make any necessary corrections. "

Since Email address is a required field, I'm stuck.

The warning at the top of the page is...

Warning: REG_EMPTY in /home/virtual/site153/fst/var/www/html/oscommerce/includes/functions/validations.php on line 97

And the error I'm getting on the form is...

"Your E-Mail Address does not appear to be valid - please make any necessary corrections. "

No valid emails get past the warning.

Code from that page is below...with line 97 marked.

Thoughts?


<?php
/*
$Id: validations.php,v 1.11 2003/02/11 01:31:02 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

////////////////////////////////////////////////////////////////////////////////////////////////
//
// Function : tep_validate_email
//
// Arguments : email email address to be checked
//
// Return : true - valid email address
// false - invalid email address
//
// Description : function for validating email address that conforms to RFC 822 specs
//
// This function is converted from a JavaScript written by
// Sandeep V. Tamhankar (stamhankar@hotmail.com). The original JavaScript
// is available at http://javascript.internet.com
//
// Sample Valid Addresses:
//
// first.last@host.com
// firstlast@host.to
// "first last"@host.com
// "first@last"@host.com
// first-last@host.com
// first.last@[123.123.123.123]
//
// Invalid Addresses:
//
// first last@host.com
//
//
////////////////////////////////////////////////////////////////////////////////////////////////
function tep_validate_email($email) {
$valid_address = true;

$mail_pat = '^(.+)@(.+)$';
$valid_chars = "[^] \(\)<>@,;:\.\\\"\[]";
$atom = "$valid_chars+";
$quoted_user='(\"[^\"]*\")';
$word = "($atom|$quoted_user)";
$user_pat = "^$word(\.$word)*$";
$ip_domain_pat='^\[([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\]$';
$domain_pat = "^$atom(\.$atom)*$";

if (eregi($mail_pat, $email, $components)) {
$user = $components[1];
$domain = $components[2];
// validate user
if (eregi($user_pat, $user)) {
// validate domain
if (eregi($ip_domain_pat, $domain, $ip_components)) {
// this is an IP address
for ($i=1;$i<=4;$i++) {
if ($ip_components[$i] > 255) {
$valid_address = false;
break;
}
}
}
else {
// Domain is a name, not an IP
if (eregi($domain_pat, $domain)) {
/* domain name seems valid, but now make sure that it ends in a valid TLD or ccTLD
and that there's a hostname preceding the domain or country. */
$domain_components = explode(".", $domain);
// Make sure there's a host name preceding the domain.
if (sizeof($domain_components) < 2) {
$valid_address = false;
} else {
$top_level_domain = strtolower($domain_components[sizeof($domain_components)-1]);
// Allow all 2-letter TLDs (ccTLDs)
if (eregi('^[a-z][a-z]$', $top_level_domain) != 1) {
$tld_pattern = '';
// Get authorized TLDs from text file
$tlds = file(DIR_WS_INCLUDES . 'tld.txt');
while (list(,$line) = each($tlds)) {
// Get rid of comments
$words = explode('#', $line);
$tld = trim($words[0]);
// TLDs should be 3 letters or more
if (eregi('^[a-z]{3,}$', $tld) == 1) {
$tld_pattern .= '^' . $tld . '$|';
}
}
// Remove last '|'
$tld_pattern = substr($tld_pattern, 0, -1);

HERE IS LINE 97 ###############################
if (eregi("$tld_pattern", $top_level_domain) == 0) {
HERE IS LINE 97 ###############################

$valid_address = false;
}
}
}
}
else {
$valid_address = false;
}
}
}
else {
$valid_address = false;
}
}
else {
$valid_address = false;
}
if ($valid_address && ENTRY_EMAIL_ADDRESS_CHECK == 'true') {
if (!checkdnsrr($domain, "MX") && !checkdnsrr($domain, "A")) {
$valid_address = false;
}
}
return $valid_address;
}
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Sponsored Links
Advertisement
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Validation in admin chitta_rn osCMax v2 Customization/Mods 0 02-17-2006 06:17 AM
order process email issue JohnW osCMax v2 Features Discussion 2 01-06-2006 07:39 PM
Authorize.net fix oncredit card validation error. pablovel osCMax v1.7 Discussion 0 05-27-2005 03:25 PM
AUTHORIZE.NET VALIDATION FIELDS-HELP whazzy osCMax v1.7 Discussion 0 03-28-2005 06:52 AM
Zip code files/validation Skidude osCommerce 2.2 Modification Help 0 09-19-2003 08:54 AM


All times are GMT -8. The time now is 06:47 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax