T4VN is an online PHP Help community that provides PHP Tutorials, PHP Examples, PHP Scripts, PHP Support
    HOME  |  HOSTING COUPON  |  TEMPLATE  |  PHP SCRIPTS  |  LINK TO US  |  LINK  |  REGISTER | CONTACT
::: Member Login :::
 Username
 Password
 
Forgot your password ?
::: PHP Tutotal :::
  PHP Basic (7)
  PHP Advanced (4)
  PHP Database (2)
  Coding Step By Step (8)
  PHP and AJAX (0)
::: PHP Example :::
  Arrays (1)
  Code Highlighters (3)
  Database Functions (12)
  Date & Time (5)
  E-Mail (6)
  Forms (5)
  Guestbooks (1)
  Logging (2)
  Miscellaneous (10)
  Password Generators (3)
  Randomizers (3)
  String Manipulation (10)
  User Authentication (6)
::: Search On T4VN :::
::: T4VN Statistics :::
  PHP Scripts : 61
  PHP Example : 67
  PHP Tutorials : 21
  PHP News : 93
  Total Coupon : 36
  Other Tutorials :
  Member : 209
  Visitor Online : 1
  Today Visit: 303
  Total Visitor : 262313
  Most Online : 31
::: Sponsored Links :::

PR 4 For This Webpage
Home Today :

E-mail validator

Author : The_Leipe_Po

this will check e-mail if they are valid e-mail, it just checks for illigal caracters and if ther is a @ and a . in the right place and stuff

PHP Example :

<?php

function check_email_address($email) {
  
// First, we check that there's one @ symbol, and that the lengths are right
  
if (!ereg("[^@]{1,64}@[^@]{1,255}"$email)) {
    
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
    
return false;
  }
  
// Split it into sections to make life easier
  
$email_array explode("@"$email);
  
$local_array explode("."$email_array[0]);
  for (
$i 0$i sizeof($local_array); $i++) {
     if (!
ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$"$local_array[$i])) {
      return 
false;
    }
  }  
  if (!
ereg("^\[?[0-9\.]+\]?$"$email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
    
$domain_array explode("."$email_array[1]);
    if (
sizeof($domain_array) < 2) {
        return 
false// Not enough parts to domain
    
}
    for (
$i 0$i sizeof($domain_array); $i++) {
      if (!
ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$"$domain_array[$i])) {
        return 
false;
      }
    }
  }
  return 
true;
}

?>


Usage Example :

PHP Example :

<?php 
include("emailcheck.php"); 

$email $_POST['email']; 

if (
check_email_address($email)) { 
      echo 
$email 'is a valid email address.'
    } else { 
      echo 
$email ' is not a valid email address.'
    } 
?> 



Other Example
Checkbox
Radio Buttons
Select Menu out of MySql


::: Resources :::
  Links Directory
  Programming 2 3
  Webmaster 2 3
  Web Design 2 3
  Web Hosting 2 3
  Other Links 2 3
  Asian ShowBiz News
  Teach Seo For You
::: New Templates :::




::: Other Tutorials :::
 Program Design

  Powered By T4VN.NET - Version 2.0 - CopyRight © T4VN.NET 2005-2007