Revision 61c30081
Added by Jim Pingle almost 15 years ago
etc/inc/dyndns.class | ||
---|---|---|
17 | 17 |
* - StaticCling (staticcling.org) |
18 | 18 |
* - DNSexit (dnsexit.com) |
19 | 19 |
* - OpenDNS (opendns.com) |
20 |
* - Namecheap (namecheap.com) |
|
20 | 21 |
* +----------------------------------------------------+ |
21 | 22 |
* Requirements: |
22 | 23 |
* - PHP version 4.0.2 or higher with CURL Library |
... | ... | |
148 | 149 |
case 'staticcling': |
149 | 150 |
case 'dnsexit': |
150 | 151 |
case 'opendns': |
152 |
case 'namecheap': |
|
151 | 153 |
$this->_update(); |
152 | 154 |
break; |
153 | 155 |
default: |
... | ... | |
416 | 418 |
curl_close($ch); |
417 | 419 |
$this->_checkStatus($data); |
418 | 420 |
break; |
421 |
case 'namecheap': |
|
422 |
/* Example: |
|
423 |
https://dynamicdns.park-your-domain.com/update?host=[host_name]&domain=[domain.com]&password=[domain_password]&ip=[your_ip] |
|
424 |
*/ |
|
425 |
$needsIP = FALSE; |
|
426 |
log_error("Namecheap: DNS update() starting."); |
|
427 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); |
|
428 |
list($hostname, $domain) = explode(".", $this->_dnsHost, 2); |
|
429 |
$server = "https://dynamicdns.park-your-domain.com/update?host={$hostname}&domain={$domain}&password={$this->_dnsPass}&ip={$this->_dnsIP}"; |
|
430 |
curl_setopt($ch, CURLOPT_URL, $server); |
|
431 |
$data = curl_exec($ch); |
|
432 |
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); |
|
433 |
curl_close($ch); |
|
434 |
$this->_checkStatus($data); |
|
419 | 435 |
default: |
420 | 436 |
break; |
421 | 437 |
} |
... | ... | |
719 | 735 |
$this->_debug($data); |
720 | 736 |
} |
721 | 737 |
break; |
738 |
case 'namecheap': |
|
739 |
if (preg_match("/internal server error/i", $data)) { |
|
740 |
$status = "phpDynDNS: (Error) Server side error."; |
|
741 |
} else if (preg_match('/success/i', $data)) { |
|
742 |
$status = "phpDynDNS: (Success) IP Address Updated Successfully!"; |
|
743 |
$successful_update = true; |
|
744 |
} else { |
|
745 |
$status = "phpDynDNS: (Unknown Response)"; |
|
746 |
log_error("phpDynDNS: PAYLOAD: {$data}"); |
|
747 |
$this->_debug($data); |
|
748 |
} |
|
749 |
break; |
|
722 | 750 |
} |
723 | 751 |
|
724 | 752 |
if($successful_update == true) { |
usr/local/www/services_dyndns.php | ||
---|---|---|
114 | 114 |
</td> |
115 | 115 |
<td class="listlr"> |
116 | 116 |
<?php |
117 |
$types = explode(",", "DNS-O-Matic, DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit,Loopia,freeDNS, DNSexit, OpenDNS"); |
|
118 |
$vals = explode(" ", "dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit loopia freedns dnsexit opendns"); |
|
117 |
$types = explode(",", "DNS-O-Matic, DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit,Loopia,freeDNS, DNSexit, OpenDNS, Namecheap");
|
|
118 |
$vals = explode(" ", "dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit loopia freedns dnsexit opendns namecheap");
|
|
119 | 119 |
$j = 0; for ($j = 0; $j < count($vals); $j++) |
120 | 120 |
if ($vals[$j] == $dyndns['type']) { |
121 | 121 |
echo htmlspecialchars($types[$j]); |
usr/local/www/services_dyndns_edit.php | ||
---|---|---|
80 | 80 |
/* input validation */ |
81 | 81 |
$reqdfields = array(); |
82 | 82 |
$reqdfieldsn = array(); |
83 |
$reqdfields = array_merge($reqdfields, explode(" ", "host username password type")); |
|
84 |
$reqdfieldsn = array_merge($reqdfieldsn, array(gettext("Hostname"),gettext("Username"),gettext("Password"),gettext("Service type"))); |
|
83 |
$reqdfields = array("host", "password", "type"); |
|
84 |
$reqdfieldsn = array(gettext("Hostname"),gettext("Password"),gettext("Service type")); |
|
85 |
if ($pconfig['type'] != "namecheap") { |
|
86 |
$reqdfields[] = "username"; |
|
87 |
$reqdfieldsn[] = gettext("Username"); |
|
88 |
} |
|
85 | 89 |
|
86 | 90 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); |
87 | 91 |
|
88 | 92 |
if (($_POST['mx'] && !is_domain($_POST['mx']))) |
89 | 93 |
$input_errors[] = gettext("The MX contains invalid characters."); |
90 |
if (($_POST['username'] && !is_dyndns_username($_POST['username'])) || $_POST['username'] == "")
|
|
94 |
if (($_POST['username'] && !is_dyndns_username($_POST['username'])) || (($pconfig['type'] != "namecheap") && ($_POST['username'] == "")))
|
|
91 | 95 |
$input_errors[] = gettext("The username contains invalid characters."); |
92 | 96 |
|
93 | 97 |
if (!$input_errors) { |
... | ... | |
153 | 157 |
<td width="78%" class="vtable"> |
154 | 158 |
<select name="type" class="formselect" id="type"> |
155 | 159 |
<?php |
156 |
$types = explode(",", "DNS-O-Matic, DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit,Loopia,freeDNS, DNSexit, OpenDNS"); |
|
157 |
$vals = explode(" ", "dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit loopia freedns dnsexit opendns"); |
|
160 |
$types = explode(",", "DNS-O-Matic, DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,ODS.org,ZoneEdit,Loopia,freeDNS, DNSexit, OpenDNS, Namecheap");
|
|
161 |
$vals = explode(" ", "dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip ods zoneedit loopia freedns dnsexit opendns namecheap");
|
|
158 | 162 |
$j = 0; for ($j = 0; $j < count($vals); $j++): ?> |
159 | 163 |
<option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['type']) echo "selected";?>> |
160 | 164 |
<?=htmlspecialchars($types[$j]);?> |
Also available in: Unified diff
First try at a dyndns update type for Namecheap.com servers.