WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : email validator check checker email e-mail email address
Categories : PHP, Email, Regexps Update Picture
Denis Merkouchev
Date : Apr 29th 1999
Grade : 5 of 5 (graded 2 times)
Viewed : 17364
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Denis Merkouchev
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?php
{
if ( eregi("(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)", $email, $arr_vars) or !eregi
("^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$", $email,
$arr_vars))
{
return(false);
}
else
{
return(true);
}
}
?>



making links from text
Categories : PHP, Regexps, Email
Clever Email Validation Function - E-Mail validation function with an eregi expression and socket connection.
Categories : Email, PHP, Regexps
validateEmail 2.0 - upgraded version of the old validateEmail function used to validate email addresses via SMTP and regex.
Categories : Email, Regexps, PHP
EAvalidator - This class can be used to validate an e-mail address by checking its domain.
Categories : PHP, PHP Classes, Email, Regexps
E-mail address check
Categories : PHP, Email, Regexps
Validating a URL with preg_match
Categories : PHP, Regexps, Beginner Guides, Data Validation
Simple Email address validation
Categories : Email, PHP, Strings
php table decoder used to convert an html table to individual tokens through regular expressions
Categories : PHP, Regexps, HTML and PHP
A PHP based webmail at : http://www.horde.org/imp
Categories : Email, IMAP, PHP, Complete Programs
Simple way to replace a variable value in a .conf (.ini) file using a webbrowser - the first stage of a complete universal configuration editor
Categories : PHP, Regexps, Code Editors, Filesystem
imap_subscribe -- Subscribe to a mailbox
Categories : PHP, PHP Functions, IMAP, Email
PHP based HTML rabbing Tools
Categories : PHP, HTML and PHP, Tag Extractors, Regexps, Beginner Guides
Class for sending mail with MIME attachments in multipart format using external sendmail, mimencode and zip
Categories : Email, Network, PHP, PHP Classes
Ping a Server and run a command to fix it if it is down
Categories : PHP, Errors and Logging, Regexps
Link Extractor - This function is used to extract links from a given URL. This will convert relative path into absolute path and also remove PHPSESSID stuff.
Categories : PHP, URLs, Regexps
 Martin Geisler wrote : 92
Hi,

well, this seems to be a good email-check, but there`s a 
little mistake. 
if you have an email-address like anything@your-
host.com it will be wrong because of the dash in the 
hostname.

Any ideas?

Martin
 
 Jussi Paju wrote : 178
You need to change

"^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$"

into

"^.+\@(\[?)[-a-zA-Z0-9\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$"

 
 Frdric De Leersnijder wrote : 285
I`ve "enhanced" the e-mail checker a bit more. Crap like
#!... in the address was accepted. I`ve also taken the past
remarks into consideration. list-request@some-host.com is a
valid address.

function validateEmail($email) {  
  if (eregi("(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)", $email) ||
!eregi
("^.+\@(\[?)[-a-zA-Z0-9\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$",
$email)) {
    return(false); 
  } else {
    list($user, $domain) = explode(`@`, $email);
    if ((!eregi("^[a-zA-Z0-9\.\-]+$", $user)) ||
(!eregi("^[a-zA-Z0-9\.\-]+$", $domain))) {
      return false;
    } else {
      return(true); 
    }
  } 
}
 
  Vincent wrote : 316
Tested out this script. It worked well, including the dash. But i found another problem with it - the underscore. An 
email address like my_name@host.com will be invalid. It should be accepted. Anyone can correct this problem? 
Thanks=)
 
 Ilia Alshanetsky wrote : 339
A small modification to address the issue with e-mail 
address that contain _. With this fix email address` can 
now have _ in them.

function validateEmail($email) { 
    if (eregi("(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)", 
$email) || !eregi ("^.+\@(\[?)[-_a-zA-Z0-9\.]+\.([a-zA-Z]
{2,3}|[0-9]{1,3})(\]?)$", $email)) { 
        return 1; 
    } 
    else { 
        list($user, $domain) = explode(`@`, 
$email); 
        if ((!eregi("^[_a-zA-Z0-9\.\-]+$", 
$user)) || (!eregi("^[_a-zA-Z0-9\.\-]+$", $domain))) { 
            return 1; 
        } 
        else { 
            return 0; 
        } 
    }
}
 
 Ilia Alshanetsky wrote : 340
I used C style returns.
1 means there was an error, 0 means everything is fine.
 
 Ian Warner wrote :632
What happens if the user has an email address:

me.here@yourdomain.com

It returns false

Can you add this support please - other than that an excellent email validation function