Wikka : URUniqueEMailModule

HomePage :: Categories :: Index :: Changes :: Comments :: Documentation :: Blog :: Login/Register

User Registration module: Only one account per email


Last edited by NilsLindenberg:
minor edit


This is a Module for the UserRegistration Framework.

It checks if the emailadress entered during registration was already used to register a useraccount. I.e. one mail-adress = one useraccount.

The code was developed due to a request from MovieLady at the SuggestionBox.

Please Test.

<?php
/**
 * Check denying the use of an Emailaddress for the registration of more then one useraccount.
 *
 * Based on code written for an old request from MovieLady at the SuggestionBox.
 *
 * To implement, set the following in wikka.config.php:
 *    'UR_validation_modules' => 'URUniqueEmailModule'
 *
 * (If combined with other modules, separate each module with a
 * comma.)
 *
 * @author {@link http://wikkawiki.org/NilsLindenberg NilsLindenberg}
 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
 *
 * @see libs/userregistration.class.php
 * @see URAuth, URAuthTmpl
 * @filesource
 */

class URUniqueEmailModule extends URAuthTmpl
{   
    var $wakka;

    /**
    * Constructor.
    */

    function URTextCaptchaModule(&$wakka)
    {
        $this->wakka = &$wakka;
    }
   
    /**
    * No need to display something.
    */

    function URAuthTmplDisplay()
    {
        return;   
    }

    /**
    *  Check if an email adress is already used for an useraccount.
    *
    * @uses    Wakka::Query
    */

    function URAuthTmplVerify()
    {
        $count = 0;
        $query =     "SELECT COUNT(email)
                    FROM "
.$this->wakka->config['table_prefix']."users
                    WHERE email='"
.mysql_real_escape_string($_POST['email'])."'";
        if ($r = $this->wakka->Query($query))
        {
            $count = mysql_result($r,0);
            mysql_free_result($r);
        }
        return ($count > 0) ? FALSE : TRUE;
    }
}
?>



CategoryUserContributions, CategoryURModules
There are no comments on this page. [Add comment]
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.0941 seconds