Jump to content
[MUST READ] Forum Rules ×

Set blacklisted email domains


Recommended Posts

18 hours ago, duckhost.ml said:

ok i will find out!

Setting this up would be relatively simple, but to implement properly may be more challenging.

Assuming you're using the default signup form, you may find it easier to create this using a multi-step process. One where your first step is to enter your email then the user submits this and you can check it against your own list of 'bad' email domains, if they check out proceed to take them to the remainder of the sign up form.

The reason for a multi step process is to properly send the captcha back to iFastnet for registration.

One glaring issue is the ease that the user can modify the form data before submitting after you've processed your checks. We can ignore this, as it is not typical for bots or random fly by users. However, as you learn and get familiar with PHP etc. this should be resolved.

 

To break this down a bit, you would have step 1 be an input textbox asking for the users email address, the user would submit this and on the following page you can use PHP to check their email domain against a list of 'bad' email domains.

A quick example script for this would be:

$e = $_POST['email'];
if ($e) {
    $e = explode('@', $e);
    $blacklist = array('wzcmail.com', 'temp-mail.org', 'otherbademail.com');
    if (in_array($e['1'], $blacklist)) {
        die('Error.');
		//Don't display the remainder of the form, ask the user to use a real email address.
    } else {
        echo 'Good to go.';
		//Continue the page asking for remaining information.
    }
}

If the email domain is in your blacklist the script would prevent them from seeing the remainder of the form blocking their registration.

If their email domain is not on your blacklist they would continue to sign up properly. You would then store the email in a hidden input box with the remainder of the form.

 

The basic components you'd need to learn and understand in PHP for this script are:

IF statements

explode()

Arrays

in_array()

You can find more on these from sites such as w3schools.com.

 

I hope this helps you understand what you'll need learn to set this up on your site, creating your own solutions to problems is the best way to begin learning.

Link to comment
Share on other sites

17 hours ago, Wizacr said:

Setting this up would be relatively simple, but to implement properly may be more challenging.

Assuming you're using the default signup form, you may find it easier to create this using a multi-step process. One where your first step is to enter your email then the user submits this and you can check it against your own list of 'bad' email domains, if they check out proceed to take them to the remainder of the sign up form.

The reason for a multi step process is to properly send the captcha back to iFastnet for registration.

One glaring issue is the ease that the user can modify the form data before submitting after you've processed your checks. We can ignore this, as it is not typical for bots or random fly by users. However, as you learn and get familiar with PHP etc. this should be resolved.

 

To break this down a bit, you would have step 1 be an input textbox asking for the users email address, the user would submit this and on the following page you can use PHP to check their email domain against a list of 'bad' email domains.

A quick example script for this would be:

$e = $_POST['email'];
if ($e) {
    $e = explode('@', $e);
    $blacklist = array('wzcmail.com', 'temp-mail.org', 'otherbademail.com');
    if (in_array($e['1'], $blacklist)) {
        die('Error.');
		//Don't display the remainder of the form, ask the user to use a real email address.
    } else {
        echo 'Good to go.';
		//Continue the page asking for remaining information.
    }
}

If the email domain is in your blacklist the script would prevent them from seeing the remainder of the form blocking their registration.

If their email domain is not on your blacklist they would continue to sign up properly. You would then store the email in a hidden input box with the remainder of the form.

 

The basic components you'd need to learn and understand in PHP for this script are:

IF statements

explode()

Arrays

in_array()

You can find more on these from sites such as w3schools.com.

 

I hope this helps you understand what you'll need learn to set this up on your site, creating your own solutions to problems is the best way to begin learning.

Thank you

Link to comment
Share on other sites

  • 2 weeks later...
3 hours ago, BastelPichi said:

You are making your life way too hard. Simply send a normal POST request with the data frm your PHP script. That way you can validate all data, and show the user a nicer email confirmation page. And not very hard.

I went a bit over board in that.

 

The idea remains relatively the same just minus the multi step form.

Link to comment
Share on other sites

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...