Email validation |
[eluser]alexaaaaaaaaaa[/eluser]
Hi i have a problem with the email validator, it seems that if i insert something like [email protected] it's working and it's passing the email validator any extension to the email validator or how to fix this issue? Thanks
[eluser]Madmartigan1[/eluser]
I think [email protected] is technically valid...? Code: /** You can create MY_Form_Validation.php and override the function there with your own. See the user guide section about extending libraries and have a look at system/libraries/Form_Validation.php
[eluser]smilie[/eluser]
Yes, by judging that preg match, after @ sign it expects minimum of 1 letter / number. I am using following script for domain and e-mail checks: http://code.google.com/p/blogchuck/sourc...#svn/trunk You have domains / email and phones scripts there. Simply add them as a helper, load it and call function (providing e-mail address). It uses IANA list of domains to check validity of extension and it can even 'call' the mail server to check that e-mail address really exists on that server - which makes it almost 100% safe check for the mail. Cheers, Smilie
[eluser]LuckyFella73[/eluser]
@smilie: thanks for sharing the validation link - it looks quite interesting! You said "just load as a helper" -> did you copy the "domains" class to the "emails" class to get it working? The class "emails" extends the class "domains" so I wonder what would be the best to do.
[eluser]smilie[/eluser]
Hi, That could probably work as well, however I have chosen for the following approach (due to the fact that I have multiple websites under 1 CI installation): I have placed domains.php as domain_helper.php in the core/helpers (not application); Then, in each application/config/autoload.php I do: Code: $autoload['helper'] = array('html','url','language','domain'); Whereby 'domain' loads the before mentioned helper. Then, in the controllers I do: Code: $domains = new Domains; Do note, that you have to download the IANA domain extension list and edit config in the domains helper so it can be 'found' by the helper. I have also placed in the cron of the server to get once a week 'newest' IANA list (although, it does not change weekly - it can't hurt) :-) Have fun! Cheers, Smilie
[eluser]LuckyFella73[/eluser]
Thanks for explaining your setup! I'll try to implement that classes in my next project where that kind of validation is needed.
[eluser]alexaaaaaaaaaa[/eluser]
Hi, thanks for the link, i have created a file named validation_helper.php and i've copy pasted the code from the link there. Now how can i use it? Please help me. Many thanks |
Welcome Guest, Not a member yet? Register Sign In |