phpScheduleIt
September 09, 2010, 04:54:27 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
: phpScheduleIt 1.2.11 has been released
Home
Help
Search
Login
Register
phpScheduleIt
>
Help and Support
>
phpScheduleIt 1.1.x
>
validate email
Pages: [
1
]
« previous
next »
Print
Author
Topic: validate email (Read 4209 times)
aicasf
Newbie
Karma: 0
Posts: 7
validate email
«
on:
October 23, 2008, 09:51:39 PM »
Hello all,
I am trying to configure phpscheduleit to only allow a certain domain to be used during self registration. i.e.
billy@abc.com
so will only allow folks with abc.com in there email to do self register. is there any way to do this? If so how? Any help with this is much appreciated!!
Logged
Nick
Administrator
Hero Member
Karma: 1
Posts: 2710
Re: validate email
«
Reply #1 on:
October 28, 2008, 01:54:40 PM »
Right after line 432 of lib/Auth.class.php, add the following:
Code:
if ( !empty($data['emailaddress']) && strpos($data['emailaddress'], '@abc.com') !== false ) {
$msg .= 'Only domain @abc.com is allowed' . '<br/>';
}
Logged
aicasf
Newbie
Karma: 0
Posts: 7
Re: validate email
«
Reply #2 on:
October 31, 2008, 05:08:48 PM »
I tried adding the code but it will allow them to register without using the domain i specified. here is the code
if ($use_logonname && empty($data['logon_name'])) {
$msg .= translate('Valid username is required') . '<br/>';
}
else if ($use_logonname) {
$data['logon_name'] = htmlspecialchars($data['logon_name']);
}
if (empty($data['emailaddress']) || !preg_match("/^[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/", $data['emailaddress']))
$msg .= translate('Valid email address is required.') . '<br/>';
if ( !empty($data['emailaddress']) && strpos($data['emailaddress'], '@aii.edu') !== false ) {
$msg .= 'Only domain @aii.edu is allowed' . '<br/>';
}
if (empty($data['fname'])) {
$msg .= translate('First name is required.') . '<br/>';
above is the code
Logged
aicasf
Newbie
Karma: 0
Posts: 7
Re: validate email
«
Reply #3 on:
October 31, 2008, 05:09:35 PM »
sorry iam using version 1.2 i posted in the wrong area maybe that is the issue
Logged
Nick
Administrator
Hero Member
Karma: 1
Posts: 2710
Re: validate email
«
Reply #4 on:
November 04, 2008, 09:33:05 AM »
I think I may have had my logic backwards.
This:
strpos($data['emailaddress'], '@aii.edu') !== false
Should be:
strpos($data['emailaddress'], '@aii.edu') === false
Logged
aicasf
Newbie
Karma: 0
Posts: 7
Re: validate email
«
Reply #5 on:
November 06, 2008, 12:36:41 PM »
Thanks so much it works but it says that only @aii.edu domain only even when the email domain is @aii.edu. It is almost there. What other change do I need to make to resolve this
Logged
Nick
Administrator
Hero Member
Karma: 1
Posts: 2710
Re: validate email
«
Reply #6 on:
November 06, 2008, 01:49:11 PM »
Hmm, I'm not sure here. Try adding this code after: $msg .= 'Only domain @aii.edu is allowed' . '<br/>';
Code:
$msg .= 'strpos return value= ' . strpos($data['emailaddress'], '@aii.edu');
This should help provide some insight as to what's going wrong.
Logged
aicasf
Newbie
Karma: 0
Posts: 7
Re: validate email
«
Reply #7 on:
November 06, 2008, 04:27:39 PM »
Thanks so much I really appreciate it
Logged
elena126
Newbie
Karma: 0
Posts: 1
Re: validate email
«
Reply #8 on:
January 29, 2010, 09:38:10 PM »
Quote from: Nick on November 04, 2008, 09:33:05 AM
I think I may have had my logic backwards.
This:
strpos($data['emailaddress'], '@aii.edu') !== false
Should be:
strpos($data['emailaddress'], '@aii.edu') === false
yeah.that looks good! thanks
________________
small business loans bad credit
bad credit business loan
business loans
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> Announcements
=> Open Discussion
=> Donations
-----------------------------
Help and Support
-----------------------------
=> phpScheduleIt 1.2.x
=> phpScheduleIt 1.1.x
=> New Features and Suggestions
=> Developers
-----------------------------
Bugs
-----------------------------
=> phpScheduleIt 1.2.x
=> phpScheduleIt 1.1.x
-----------------------------
Modifications
-----------------------------
=> Post Modifications
=> Request Modification
-----------------------------
Development
-----------------------------
=> phpScheduleIt 2.0
-----------------------------
Off-Topic
-----------------------------
=> Non-phpScheduleIt Discussion
Loading...