osCmax v2.5 User Manual
Results 1 to 3 of 3

Email Validation Problem

This is a discussion on Email Validation Problem within the osCmax v2 Installation issues forums, part of the osCmax v2.0 Forums category; When a client tries to open a new account and their email address has numbers or an underscore in the ...

      
  1. #1
    Lurker
    Join Date
    Sep 2007
    Posts
    2
    Rep Power
    0


    Default Email Validation Problem

    When a client tries to open a new account and their email address has numbers or an underscore in the user they receive the following:
    Your E-Mail Address does not appear to be valid - please make any necessary corrections.

    Can someone show me how to add what is required to allow these email addresses.

    The following is my validations.php
    PHP Code:
     <?php

      
    ////////////////////////////////////////////////////////////////////////////////////////////////
      //
      // 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 JavaScript Source: Free JavaScripts, Tutorials, Example Code, Reference, Resources, And Help
      //
      // Sample Valid Addresses:
      //
      //    first.last@host.com
      //    firstlast@host.to
      //    "first last"@host.com
      //    "<A href="mailto: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_pattern0, -1);
                    if (
    eregi("$tld_pattern"$top_level_domain) == 0) {
                        
    $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;
      }
    ?>
    Thank you in advance for any help

  2. #2
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default Re: Email Validation Problem

    I think you would need to add the underscore to the valid characters list:
    PHP Code:
    $valid_chars "[^] \(\)<>@,;:\.\\\"\[]"
    Michael Sasek
    osCMax Developer


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  3. #3
    Lurker
    Join Date
    Sep 2007
    Posts
    2
    Rep Power
    0


    Default Re: Email Validation Problem

    I dont suppose I could get you to example that for me and include numbers in the valid characters as well.
    Many Thanks

Similar Threads

  1. Email Problem
    By yulises in forum osCmax v2 Customization/Mods
    Replies: 0
    Last Post: 08-24-2007, 01:41 AM
  2. Email problem on webmail n aslo cupons problem
    By jikey in forum osCmax v2 Installation issues
    Replies: 0
    Last Post: 10-25-2006, 11:43 PM
  3. Email problem if PWA=false
    By eric4444 in forum osCMax v2 Features Discussion
    Replies: 0
    Last Post: 03-05-2006, 04:27 PM
  4. email problem
    By kellycog in forum osCommerce 2.2 Modification Help
    Replies: 2
    Last Post: 09-10-2004, 10:27 AM
  5. Email validation issue
    By webguy262 in forum osCommerce 2.2 Installation Help
    Replies: 0
    Last Post: 06-24-2004, 10:20 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •