Jump to content
  • 0

Block certain TLD's?


Question

Posted

Hello,

Is there a plugin out that allows certain TLD's from being a supported TLD when purchasing my web hosting service? For example, I want to block .tk TLD's from being supported.

Regards,

Tyler

8 answers to this question

Recommended Posts

  • 1
Posted

i have tested the code now, you can use this regex

 

            'cpanel_domain' => [
                'format' => [
                    'rule' => [[$this, 'validateHostName']],
                    'message' => Language::_('Cpanel.!error.cpanel_domain.format', true)
                ],
                'test' => [
                    'rule' => ['substr_compare', 'test', 0, 4, true],
                    'message' => Language::_('Cpanel.!error.cpanel_domain.test', true)
                ],
                'block' => [
                    // 'if_set' => true,
                    'rule' => ['matches', '/^((?!.ga|.tk|.td|.cf).)*$/'],
                    'message' => 'this domain is not alowded'
                ],
            ],

 

  • 0
Posted
9 hours ago, mobbdeep said:

Hello,

Is there a plugin out that allows certain TLD's from being a supported TLD when purchasing my web hosting service? For example, I want to block .tk TLD's from being supported. 

Regards,

Tyler

i think you are talking about hosting module not registrar module ?

 

  • 0
Posted
4 hours ago, mobbdeep said:

I am still needing an answer to this. I have been getting a mass influx of someone using .ga, .tk, and .cf TLD's to purchase my web hosting for fraudulent sites.

if you are using cpanel module, open the file /components/modules/cpanel/cpanel.php and  change the line from

            'cpanel_domain' => [
                'format' => [
                    'rule' => [[$this, 'validateHostName']],
                    'message' => Language::_('Cpanel.!error.cpanel_domain.format', true)
                ],
                'test' => [
                    'rule' => ['substr_compare', 'test', 0, 4, true],
                    'message' => Language::_('Cpanel.!error.cpanel_domain.test', true)
                ]
            ],

to

            'cpanel_domain' => [
                'format' => [
                    'rule' => [[$this, 'validateHostName']],
                    'message' => Language::_('Cpanel.!error.cpanel_domain.format', true)
                ],
                'test' => [
                    'rule' => ['substr_compare', 'test', 0, 4, true],
                    'message' => Language::_('Cpanel.!error.cpanel_domain.test', true)
                ],
                'block' => [
                    'if_set' => true,
                    'rule' => ['matches', '/(.ga|.tk|.td|.cf)/'],
                    'message' => 'this domain is not alowded'
                ],
            ],

not tested. but it might work

  • 0
Posted
8 hours ago, Blesta Addons said:

if you are using cpanel module, open the file /components/modules/cpanel/cpanel.php and  change the line from


            'cpanel_domain' => [
                'format' => [
                    'rule' => [[$this, 'validateHostName']],
                    'message' => Language::_('Cpanel.!error.cpanel_domain.format', true)
                ],
                'test' => [
                    'rule' => ['substr_compare', 'test', 0, 4, true],
                    'message' => Language::_('Cpanel.!error.cpanel_domain.test', true)
                ]
            ],

to


            'cpanel_domain' => [
                'format' => [
                    'rule' => [[$this, 'validateHostName']],
                    'message' => Language::_('Cpanel.!error.cpanel_domain.format', true)
                ],
                'test' => [
                    'rule' => ['substr_compare', 'test', 0, 4, true],
                    'message' => Language::_('Cpanel.!error.cpanel_domain.test', true)
                ],
                'block' => [
                    'if_set' => true,
                    'rule' => ['matches', '/(.ga|.tk|.td|.cf)/'],
                    'message' => 'this domain is not alowded'
                ],
            ],

not tested. but it might work

This did not work. I can still choose any of those extensions and proceed onto the order form.

  • 0
Posted
9 hours ago, Blesta Addons said:

i have tested the code now, you can use this regex

 


            'cpanel_domain' => [
                'format' => [
                    'rule' => [[$this, 'validateHostName']],
                    'message' => Language::_('Cpanel.!error.cpanel_domain.format', true)
                ],
                'test' => [
                    'rule' => ['substr_compare', 'test', 0, 4, true],
                    'message' => Language::_('Cpanel.!error.cpanel_domain.test', true)
                ],
                'block' => [
                    // 'if_set' => true,
                    'rule' => ['matches', '/^((?!.ga|.tk|.td|.cf).)*$/'],
                    'message' => 'this domain is not alowded'
                ],
            ],

 

This worked. Thank you!

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...