Jump to content

[SOLVED] block email addresses or domains on signup


Recommended Posts

Heya all,

 

just need some help or ideas on registration with emails, what id like to have is block certain email addresses or domains when users join up, so if its a certain email address it says when they click signup that email address is not allowed or valid any help would be appreciated, some coding below to help out.

 

 

Many Thanks

 

if((!isset($email_address)) ||

  (!isset($username)) ||

  (!isset($nickname)) ||

  (!isset($password)) ||

  (!isset($password2)) ||

  ($password!=$password2) ||

  (!ereg("^[A-za-z0-9]+$",$_POST['username'])) ||

  (!ereg("^.+\..+$",$_POST['email_address'])) ||

  ($checku > 0) || ($checkn > 0)|| ($checke > 0))

{

                          print("Please fix the following.<BR>");

if(!isset($_POST['email_address']))

{

print("Enter a email address.<BR>");

}

if(!isset($_POST['username']))

{

print("Enter a username.<BR>");

}

if(!isset($_POST['nickname']))

                          }

if(!isset($_POST['password']))

{

print("Enter a password.<BR>");

}

if(!isset($_POST['password2']))

{

print("Enter a confirm password.<BR>");

}

if($_POST['password']!=$_POST['password2'])

{

print("Password and confirm do not match!.<BR>");

unset($password);

unset($password2);

}

if(!ereg("^[A-za-z0-9]+$",$_POST['username']))

{

print("Enter a Valid username with letters and numbers only.<BR>");

unset($username);

}

if(!ereg("^.+\..+$",$_POST['email_address']))

{

print("Enter a valid email address.<BR>");

unset($email_address);

}

if($checku > 0)

{

print("Username already in use!<BR>");

unset($username);

}

if($checkn > 0)

{

print("Nickname already in use!<BR>");

unset($nickname);

}

if($checke > 0)

{

print("Email already in use!");

unset($email_address);

}         

  • 7 months later...
$BlockedNames = array('blah', 'bleh', 'something');
$BlockedDomains = array('something.com', 'something.something');

$email = "test@domain.com";
list($name, $domain) = explode("@", $email);

if(in_array($name, $BlockedName) || in_array($domain, $BlockedDomain)) {
    //blocked
}

$BlockedNames = array('blah', 'bleh', 'something');
$BlockedDomains = array('something.com', 'something.something');

$email = "test@domain.com";
list($name, $domain) = explode("@", $email);

if(in_array($name, $BlockedName) || in_array($domain, $BlockedDomain)) {
    //blocked
}

 

 

lol heya corbin and thanks for the reply, could you explain how that works and where I would exactly place that in the script

 

 

Regards


if($_POST) {
$email = (isset($_POST['email'])) ? $_POST['email'] : '';
$BlockedNames = array('blah', 'bleh', 'something');
$BlockedDomains = array('something.com', 'something.something');

@list($name, $domain) = explode("@", $email);

if(in_array($name, $BlockedNames) || in_array($domain, $BlockedDomains)) {
	echo 'Blocked';
}
}

echo <<<H
<form action="" method="POST">
<input type="text" name="email" /><br />
<input type="submit" value="Go" />
</form>

H;


This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.