registration criteria registration criteria
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

registration criteria

Started by mich, November 02, 2003, 03:47:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mich

i would like to limit the registration process to only person with a email of our organization, say "xxx@mycompany.com".
Can any one tell me how to do this?
thanks in advance.

Joachim Müller

edit register.php and find if (!eregi("^[_\.0-9a-z\-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$", $email)) $error .= '<li>' . $lang_register_php['err_invalid_email']; Add after it something likeif (strstr($email, '@') !="foobar.com")
{
error .= 'Only users of foobar.com are allowed to register';
}

Note that I haven't tested this, but something along these lines should work...

GauGau

P.S. next time you post a support request, please do so on the proper support board, not in "General discussion". I moved your thread to 1.2.0 support, because I don't know what version you're running

mich

i got a blank page after adding the code. Could anyone help me??

Joachim Müller


mich

i have tried to remove the code added, then it became ok again...

http://218.190.83.184/

the code being added like:
    if (strlen($user_name) < 2) $error .= '<li>' . $lang_register_php['err_uname_short'];
    if (strlen($password) < 2) $error .= '<li>' . $lang_register_php['err_password_short'];
    if ($password == $user_name) $error .= '<li>' . $lang_register_php['err_uname_pass_diff'];
    if ($password != $password_again) $error .= '<li>' . $lang_register_php['err_password_mismatch'];

    if (!eregi("^[_\.0-9a-z\-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$", $email)) $error .= '<li>' . $lang_register_php['err_invalid_email'];

if (strstr($email, '@') !="foobar.com")
{
error .= 'Only users of foobar.com are allowed to register';
}

    if ($error != '') return false;

    if (!$CONFIG['allow_duplicate_emails_addr']) {
        $sql = "SELECT user_id " . "FROM {$CONFIG['TABLE_USERS']} " . "WHERE user_email = '" . addslashes($email) . "'";
        $result = db_query($sql);