1

(10 replies, posted in PunBB 1.2 discussion)

I commented out the flood registration check. Students will be registering from behind a proxy, one per hour won't work...! It would be nice if that were an admin option wink

First class tomorrow...

2

(10 replies, posted in PunBB 1.2 discussion)

Ah, but you have to be able to register with subdomains. eg when it says "uts.edu.au" up there, then 235213@student.uts.edu.au is also a valid email address.

Hi, I thought I might just make a quick note here in case it's useful to anyone. I need to restrict registrations to one of a set of pre-defined email addresses. This is for a site that is being run for University classes.

In config.php, add (for example):

$email_whitelist = array(
  "uts.edu.au",
  "eecs.berkeley.edu"
);

In lang/English/common.php, add:

'Unlisted e-mail'               =>      'This email address does not match the list of valid email suffixes. Please post in the login help forum if you believe this is an error.',

In register.php, after:

        if (!is_valid_email($email1))   
                message($lang_common['Invalid e-mail']);

add:

        else if (!is_email_whitelisted($email1))
                message($lang_common['Unlisted e-mail']);   

And in include/email.php, add:

//
// Check if an email address is whitelisted
//
function is_email_whitelisted($email) {
        global $email_whitelist;
        foreach ($email_whitelist as $p) {
                $p1 = ereg_replace('\.', '\\.', $p);
                $p2 = '^[^@]+@' . $p1 . '$';
                $p3 = '^[^@]+@[^@]+\.' . $p1 . '$';

                if (eregi($p2, $email) || eregi($p3, $email))
                        return true;
        }
        return false;
}

Only tested quickly but it seems to work. Thanks smile

JohnR