Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  yordan : (19 June 2013 - 02:28 PM) Long Life To Asta New Era
@  agyat : (19 June 2013 - 01:58 PM) New Era Start At Asta Or Asta Start In New Era. :unsure:
@  yordan : (16 June 2013 - 05:41 PM) You're Welcome, Agyat!
@  agyat : (16 June 2013 - 07:38 AM) Thanks Yordan...
@  velma : (16 June 2013 - 12:06 AM) I Have Asked Opa To Check For A Backup.. He'll Let Me Know Soon :)
@  velma : (16 June 2013 - 12:05 AM) T_T It Seems That Someone Has Deleted That Topic Since I Found The Url Of The Topic But It Gives Me An Error
@  yordan : (15 June 2013 - 10:31 PM) @velma : It's A Tuto On How To Create A Login Program.
@  yordan : (15 June 2013 - 10:31 PM) Happy Birthday To Youuuuuu Agyat!
@  yordan : (15 June 2013 - 10:31 PM) Ba$
@  agyat : (15 June 2013 - 04:41 PM) :(
@  agyat : (15 June 2013 - 04:41 PM) Where The Hall I Were? 15Th Is Almost At End And No-One Wished Me "happy Birthday"!!!
@  velma : (14 June 2013 - 10:39 AM) Which Tutorial Is He Searching For?
@  velma : (14 June 2013 - 10:38 AM) Which Tutorial Is He Searching For?
@  yordan : (14 June 2013 - 07:47 AM) Ok, Have A Look Tomorrow.
@  yordan : (13 June 2013 - 03:19 PM) @velma, Can You Have A Look At Feelay's Problem? Seems That His Tutorial Is Not Searchable Today.
@  Feelay : (13 June 2013 - 08:11 AM) Oh, Haha
@  velma : (12 June 2013 - 05:39 PM) T_T Lately My Levels Of Procrastination..... **sigh**
@  velma : (12 June 2013 - 05:38 PM) I'll Do It Later
@  velma : (12 June 2013 - 05:38 PM) Procrastinators.. People Who Keep Saying "i'll Do This In A Bit"
@  Feelay : (12 June 2013 - 02:05 PM) Deal Punishments To What?

Replying to Simple E-mail Validation


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

mastercomputers

Posted 15 September 2005 - 02:41 PM

I don't think there's anything wrong with reinventing the wheel if it has modifications to it. I have seen a lot of validation classes and instead of being as complete as they could be, they opt for an easy method and check the basics, they then rely on another method (usually confirmation email) to check if that address really does exist. If there validation checked it as efficiently as it could be, it would save them the hassle of even sending the email, having it rejected/returned because the address did not exist.

if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,4}$", $email))

I honestly believe I have seen this code before.

If we follow the standards set out by the RFC, there are quite a few things we aren't making sure that we do in this validation, most notable is this script allows the beginning of an email address to be a number. That's one flaw. It has limited the length of the end of an email. It may or may not work with archaeologist@someplace.musuem which could be a valid email address. It does not allow IPv4 or IPv6 addresses for domain name which are also valid yet RFC recommends using Fully Qualified Domain Names (FQDN).

I should probably update my email validation script that I did on here with my one that I did to meet the majority of what I found in the RFC on the subject.

To make use of an email validation you should also use ECMAScript (Javascript) to validate it first and then PHP server side to validate it (double check). At least with ECMAScript you can notify the user that it's incorrect before making them submit the form saving time.


Cheers,


MC

jvizueta

Posted 15 September 2005 - 06:06 AM

I'm really sorry, but why should I worry about any kind of validation if there are a lot of php classes that do basic validations like this one, and much more? B)

rc_FormValidatior

I've looked over the web for the best validation PHP script and this is not the most complete, but the easiest and the most flexible I think, and that's why it's my favorite :P

don't re invent the wheel :blink:

blazedupthug

Posted 31 August 2005 - 09:23 AM

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

Review the complete topic (launches new window)