We have 25 guests online
   
PHP Scripts arrow Free PHP Tutorials arrow Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP 
Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP

Email validation
User Rating: / 1
PoorBest 
This function checks email for validity: check for '@', '.' characters and bad characters that you can define yourself.
  1. <?php
  2. #############################################################
  3. # This function checks email for validity5:
  4. # check for '@', '.' characters and bad characters that you
  5. # can define yourself.
  6. # Contact us at: This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
  7. # Welcome to our Web site at http://php.inc.ru
  8. #############################################################
  9. function check_email($email)
  10. {
  11.     $emailArray = preg_split('//', $email);
  12.     $atSign = false;
  13.     $dotSign = false;
  14.     $badCharacter = false;
  15.     $validEmail = true;
  16.    
  17.    
  18.     if (in_array ("@", $emailArray))
  19.     {
  20.         $atSign = true;
  21.     }
  22.     if (in_array (".", $emailArray))
  23.     {
  24.         $dotSign = true;
  25.     }
  26.    
  27.     $badCharactersArray = array('#', '$', '%', '(', ')', '&', '!');    // Add your own bad
  28.                                                                        // characters here;
  29.    
  30.     for ($i = 0; $i < sizeof($badCharactersArray); $i++)
  31.     {
  32.         if (in_array ($badCharactersArray[$i], $emailArray))
  33.         {
  34.             $badCharacter = true;
  35.         }
  36.     }
  37.    
  38.     if ((!$atSign) or (!$dotSign) or ($badCharacter))
  39.     {
  40.         $validEmail = false;
  41.     }
  42. }
  43. ?>

 

 

Directory Stats

There are 684 listing and 43 categories in our website

Change Language

Loans
Final Fantasy Wallpapers
Car Credit
McDonalds
Myspace Comments