Topic: Restrict signup emails
How would I go about restricting email addresses used during signup?
Example: I only want users with @gmail.com or @hotmail.com.
Also, could this work for emails with prefixes?
Example: user@example.website.com?
You are not logged in.
How would I go about restricting email addresses used during signup?
Example: I only want users with @gmail.com or @hotmail.com.
Also, could this work for emails with prefixes?
Example: user@example.website.com?
Yes, this can restrict certain email addresses but I want my site to be exclusive to only a handful of email addresses.
Example: ONLY users with xxx@gmail.com or xxx@hotmail.com can sign up.
Ok so I found the code for the banned email list in lib.account_register.php. How do I reverse this code to ONLY allow the emails in the list to register?
Here's the code:
//------------------------------------------------
// Check if email address is allowed
//------------------------------------------------
$emails = explode("\n", $PREFS->conf['banned_emails']);
//------------------------------------------------
// Check if the email is banned
//------------------------------------------------
foreach ($emails as $value)
{
$value = trim($value);
if (substr($value, 0, 1) == '@' && strpos($email, $value) !== false)
{
$TEMPLATE->set_message("error", ($LANG['register']['banned_email']), 0, 0);
return 0;
}
elseif ($value == $email)
{
$TEMPLATE->set_message("error", ($LANG['register']['banned_email']), 0, 0);
return 0;
}
}
if (!$type_id)
{
$TEMPLATE->set_message("error", ($LANG['register']['empty_type_id']), 0, 0);
return 0;
}
$query_keys = $query_values = "";
$items_values = array();Got it!
Changed:
$value = trim($value);
if (substr($value, 0, 1) == '@' && strpos($email, $value) !== false)To:
$value = trim($value);
if (substr($value, 0, 1) == '@' && strpos($email, $value) == false)(Just removed the "!")