Jump to content
xisto Community

blazedupthug

Members
  • Content Count

    1
  • Joined

  • Last visited

  1. Hey , this tutorial will tell you a very simple way to check if email addresses entered are with the correct syntax. Hope this will help you eliminate jokers. So this script will... (check the characters, and check if there is a " someone[at]somewhere.extension ". Ok, so firstly we create a function with all the invalid stuff in it:- function CheckMail($email) {if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,4}$", $email)) { return true;}else { return false; }} Now, to check an email you just run the variable with the email in it through the function as follows:- if ((empty($email)) || (!CheckMail($email]))){Die("Please go back and put in a valid e-mail adress!");} Alright people first part checks the field has data in it, and the second part uses the function for the characters. CheckMail shall return false if the email is incorrect and the script stops executing & echos an error message. Hope that helps you! Written by blazedupthug Notice from jipman: CODE-tags Moved to programming > scripting > php
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.