Jump to content

Recommended Posts

Hi everyone - I'm a PHP-newbie, and my skills at this point are pretty limited.  I got some wonderful help from the folks at Joomla forums in putting together a function to restrict attempts to register at a site to a certain e-mail domain:

[quote]// hack by Kenneth Crowder (ChiefGoFor) to allow registration to be restricted by domain. (6-30-2006)
if ($_REQUEST[option]=="com_registration" && ((trim($this->email == "")) || (preg_match("/[\w\.\-]+@university.edu/", $this->email )==false))) {
$this->_error = 'Sorry, but only users with email addresses ending in "university.edu" may register.';
return false;
}
else if ((trim($this->email == "")) || (preg_match("/[\w\.\-]+@\w+[\w\.\-]*?\.\w{1,4}/", $this->email )==false)) {
$this->_error = _REGWARN_MAIL;
return false;
}[/quote]

The code works beautifully, but my needs are a little more complex than this.  I'm dealing with registration for a university society, at a school where e-mail addresses can have multiple subdomains, and which has more than one domain name.  To state what I'm trying to do in natural language, in the hope that someone can help me translate it into PHP, here's what I would like this function to do:

[quote]if address = [*member*]@[*subdomain*].[university].edu, register this person, otherwise return error message
or if address = [*member*]@[*subdomain*].[university-other-domain].edu, register this person, otherwise return error message
(where *member* and *subdomain* are both wildcards, but university and university-other-domain represent fixed strings)[/quote]

Thanks in advance to anyone who can point me in the right direction!

Original post on Joomla forums: http://forum.joomla.org/index.php/topic,73427.msg379972.html
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.