Jump to content

Validating an email address

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
kromagnon

kromagnon

    Learning Programmer

  • Members
  • PipPipPip
  • 50 posts
If I have a form where a user needs to put in an email address, how can I test that to make sure that it is in fact an email address (something@somewhere) and not just crap(crapcrapcrap)

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests

<?PHP

///////////////////////////////////////////////////////////////////////

// Author: Jordan

// Date: 9-30-05

// Copyright: 2005

// Description: Validates email addresses inside

//     of a function call

///////////////////////////////////////////////////////////////////////


// take a given email address and split it into the  

// username and domain.


function ValidateEmail($v_email)

{


	list($v_userName, $v_mailDomain) = split("@", $v_email);

	if (ValidateEmail2($v_mailDomain, "MX")) {

 		// this is a valid email domain!

		return true;

	}


	else {

		  // this email domain doesn't exist! bad dog! no biscuit!

		  return false;

	}


}

?>



#3
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
Jordan, you have a function in there ValidateEmail2 that isn't in your code above. This function wont run.