Revision [19974]

This is an old revision of URUniqueEMailModule made by NilsLindenberg on 2008-05-25 13:05:34.

 

User Registration module: Only one account per email


Last edited by NilsLindenberg:
created
Sun, 25 May 2008 13:05 UTC [diff]


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. Load questions and answers from the config file.
     */

    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.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki