If you use the default WHMCS DNS management, it is recommended to activate the "Create DNS Zone" mode, see module settings. The module can set the default value for new DNS zones via the module settings. Furthermore the module has the possibility to add own DNS records via a PHP function. This is helpful if you want to create additional default records or if you want to create the DNS records service based.

Additional information about this feature:

  • The PHP function is only executed if you activate the "Create DNS Zone" mode.
  • If the return is empty, the default DNS entries are created, which are defined in the module settings.

How to activate

To activate the feature, please proceed as follows:

  1. Navigate into the directory /modules/registrars/smartnic/
  2. Create the file customdns.php with following content:

    <?php
    
    function smartnic_customDNS ($params) {
    	return array (  array ('hostname' => '@', 'type' => 'a', 'address' => '5.4.3.2', 'aux' => '', 'ttl' => '300'),
                        array ('hostname' => 'www', 'type' => 'a', 'address' => '5.4.3.2', 'aux' => '', 'ttl' => '300'),
                        array ('hostname' => '@', 'type' => 'MX', 'address' => 'mail.example.org', 'aux' => '1', 'ttl' => '300'),
        );
    }

    You have to adjust the array according to your needs. AUX stands for the priority of the record, which only plays a role for MX and SRV records.

The $params argument contains all details about the domain, which allows you to programmatically store DNS records depending on the domain. Detailed information about the content are available here.

  • No labels