Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Form Validation, allow only one email domain.
Old 02-18-2008, 12:33 AM Form Validation, allow only one email domain.
Tixylix's Avatar
Super Talker

Posts: 110
Name: Steve
Location: Australia
Trades: 0
Here is the validate.js code for the script I am using (which refers to validating the email box).

Code:
        this.setHandler('email',
            function (value) {
                regex=/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
                return regex.test(value);
            }
        );
Is it possible to change this somehow to only allow it to accept certain email domans, such as "@gmail.com" so you couldn't register with another, such as "@hotmail.com"

Thanks.
__________________
There's more to be discovered...

Please login or register to view this content. Registration is FREE

Tixylix is offline
Reply With Quote
View Public Profile Visit Tixylix's homepage!
 
 
Register now for full access!
Old 02-18-2008, 02:30 AM Re: Form Validation, allow only one email domain.
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
replace the regex string with something like this:
Code:
regex=/^[a-zA-Z0-9._-]+@(gmail|hotmail)\.com$/;
BTW your regex is incorrect because it will allow the address somesht@somedomain.c-m or even aa@bb...9
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 02-18-2008, 03:27 AM Re: Form Validation, allow only one email domain.
Tixylix's Avatar
Super Talker

Posts: 110
Name: Steve
Location: Australia
Trades: 0
Well they would want a valid email anyway if they want to receive the verification email. But I will use your suggestion from now on.

Thanks.
__________________
There's more to be discovered...

Please login or register to view this content. Registration is FREE

Tixylix is offline
Reply With Quote
View Public Profile Visit Tixylix's homepage!
 
Old 02-18-2008, 04:31 AM Re: Form Validation, allow only one email domain.
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
What is the reason of using input validation if you send verification email anyway?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 02-18-2008, 05:42 AM Re: Form Validation, allow only one email domain.
Tixylix's Avatar
Super Talker

Posts: 110
Name: Steve
Location: Australia
Trades: 0
I only want people from a certain company to register.
__________________
There's more to be discovered...

Please login or register to view this content. Registration is FREE

Tixylix is offline
Reply With Quote
View Public Profile Visit Tixylix's homepage!
 
Reply     « Reply to Form Validation, allow only one email domain.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27943 seconds with 12 queries