Jump to content
  • 0

Block certain TLD's?


mobbdeep

Question

8 answers to this question

Recommended Posts

  • 1

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'
                ],
            ],

 

Link to comment
Share on other sites

  • 0
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 ?

 

Link to comment
Share on other sites

  • 0
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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 0
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!

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
Answer this question...

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

Loading...
×
×
  • Create New...