Reputation: 11
Actually we are using WHMCS Email Notification module to sell a ccTLD which does not have a integrated registrar. In this case Email Notification sends us notification whenever user register a domain or save nameserver and we perform that action according to that email notification.
However it doesn't save the nameservers on the database, so user sees blank on the nameserver field, this makes confusion among the users regarding nameserver update. And we are trying to solve this issue by storing the nameservers in WHMCS database and fetch to those domains as needed.
WHMCS Sample registrar module: https://github.com/WHMCS/sample-registrar-module/blob/master/modules/registrars/registrarmodule/registrarmodule.php
Email Notification module: (This is what we are using for that ccTLD domain registration, I tried saving NS by adding the bold codes)
<?php
function email_getConfigArray() {
$configarray = array(
"FriendlyName" => array("Type" => "System", "Value"=>"Email Notifications"),
"Description" => array("Type" => "System", "Value"=>"This module can be used for any TLDs that have no integrated registrar"),
"EmailAddress" => array( "Type" => "text", "Size" => "40", "Description" => "Enter the email address notifications should be sent to", ),
);
return $configarray;
}
function email_GetNameservers($params) {
return array('ns1'=>'');
}
/**
* Sends the passed nameservers to the defined email address
* @param array $params The built array of data to save the nameservers
*/
function email_SaveNameservers($params) {
global $CONFIG;
$command = "Save Nameservers";
$message = <<<EMAIL
Domain: {$params["sld"]}.{$params["tld"]}<br>
Registration Period: {$params["regperiod"]}<br>
Nameserver 1: {$params["ns1"]}<br>
Nameserver 2: {$params["ns2"]}<br>
Nameserver 3: {$params["ns3"]}<br>
Nameserver 4: {$params["ns4"]}<br>
Nameserver 5: {$params["ns5"]}<br>
EMAIL;
$headers = "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=" . $CONFIG['Charset'] . "\r\n";
$headers.= "From: " . $CONFIG["CompanyName"] . " <" . $CONFIG["Email"] . ">\r\n";
mail($params["EmailAddress"], $command, $message, $headers);
$servername = "localhost";
$username = "yvqvnhmz_whmc536";
$password = "3s63)(95pS";
$dbname = "yvqvnhmz_whmc536";
$conn = mysqli_connect($servername, $username, $password, $dbname);
$sql = "INSERT INTO tbldomains (domain, ns1, ns2)
VALUES ('{$params["sld"]}.{$params["tld"]}', '{$params["ns1"]}', '{$params["ns2"]}')";
mysqli_close($conn);
}
function email_RegisterDomain($params) {
global $CONFIG;
$command = "Register Domain";
$message = "Domain: ".$params["sld"].".".$params["tld"]."<br>Registration Period: ".$params["regperiod"]."<br>Nameserver 1: ".$params["ns1"]."<br>Nameserver 2: ".$params["ns2"]."<br>Nameserver 3: ".$params["ns3"]."<br>Nameserver 4: ".$params["ns4"]."<br>RegistrantFirstName: ".$params["firstname"]."<br>RegistrantLastName: ".$params["lastname"]."<br>RegistrantOrganizationName: ".$params["companyname"]."<br>RegistrantAddress1: ".$params["address1"]."<br>RegistrantAddress2: ".$params["address2"]."<br>RegistrantCity: ".$params["city"]."<br>RegistrantStateProvince: ".$params["state"]."<br>RegistrantCountry: ".$params["country"]."<br>RegistrantPostalCode: ".$params["postcode"]."<br>RegistrantPhone: ".$params["phonenumber"]."<br>RegistrantEmailAddress: ".$params["email"]."<br>AdminFirstName: ".$params["adminfirstname"]."<br>AdminLastName: ".$params["adminlastname"]."<br>AdminOrganizationName: ".$params["admincompanyname"]."<br>AdminAddress1: ".$params["adminaddress1"]."<br>AdminAddress2: ".$params["adminaddress2"]."<br>AdminCity: ".$params["admincity"]."<br>AdminStateProvince: ".$params["adminstate"]."<br>AdminCountry: ".$params["admincountry"]."<br>AdminPostalCode: ".$params["adminpostcode"]."<br>AdminPhone: ".$params["adminphonenumber"]."<br>AdminEmailAddress: ".$params["adminemail"]."";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$CONFIG["CompanyName"]." <".$CONFIG["Email"].">\r\n";
mail($params["EmailAddress"],$command,$message,$headers);
}
function email_TransferDomain($params) {
global $CONFIG;
$command = "Transfer Domain";
$message = "Domain: ".$params["sld"].".".$params["tld"]."<br>Registration Period: ".$params["regperiod"]."<br>Transfer Secret: ".$params["transfersecret"]."<br>RegistrantFirstName: ".$params["firstname"]."<br>RegistrantLastName: ".$params["lastname"]."<br>RegistrantOrganizationName: ".$params["companyname"]."<br>RegistrantAddress1: ".$params["address1"]."<br>RegistrantAddress2: ".$params["address2"]."<br>RegistrantCity: ".$params["city"]."<br>RegistrantStateProvince: ".$params["state"]."<br>RegistrantCountry: ".$params["country"]."<br>RegistrantPostalCode: ".$params["postcode"]."<br>RegistrantPhone: ".$params["phonenumber"]."<br>RegistrantEmailAddress: ".$params["email"]."";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$CONFIG["CompanyName"]." <".$CONFIG["Email"].">\r\n";
mail($params["EmailAddress"],$command,$message,$headers);
}
function email_RenewDomain($params) {
global $CONFIG;
$command = "Renew Domain";
$message = "Domain: ".$params["sld"].".".$params["tld"]."<br>Registration Period: ".$params["regperiod"]."";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$CONFIG["CompanyName"]." <".$CONFIG["Email"].">\r\n";
mail($params["EmailAddress"],$command,$message,$headers);
}
Upvotes: 1
Views: 218
Reputation: 21
WHMCS never actually stores the nameserver values, instead passing those values through the registrar module's connected API integration where it would reach the registrar remotely, who's responsibility it is to store this data.
You'd need to create a backend that could be queried by your registrar module to provide these values. WHMCS, itself, populates these values by querying the remote registrar using the registrar module assigned to the domain.
Upvotes: 0