Be smarter about how to split a Namecheap hostname into host/domain. Fixes #2144

This commit is contained in:
jim-p 2012-01-26 12:11:58 -05:00
parent 6f0dc800b7
commit e8fc69ff43

View File

@ -390,7 +390,11 @@
$needsIP = FALSE;
log_error("Namecheap: DNS update() starting.");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
list($hostname, $domain) = explode(".", $this->_dnsHost, 2);
$dparts = explode(".", $this->_dnsHost);
$domain_part_count = ($dparts[count($dparts)-1] == "uk") ? 3 : 2;
$domain_offset = count($dparts) - $domain_part_count;
$hostname = implode(".", array_slice($dparts, 0, $domain_offset));
$domain = implode(".", array_slice($dparts, $domain_offset));
$server = "https://dynamicdns.park-your-domain.com/update?host={$hostname}&domain={$domain}&password={$this->_dnsPass}&ip={$this->_dnsIP}";
curl_setopt($ch, CURLOPT_URL, $server);
break;