1
|
<?php
|
2
|
/*
|
3
|
* PHP.updateDNS (pfSense version)
|
4
|
*
|
5
|
* +====================================================+
|
6
|
* Services Supported:
|
7
|
* - DynDns (dyndns.org) [dynamic, static, custom]
|
8
|
* - DHSDns (dhs.org)
|
9
|
* - No-IP (no-ip.com)
|
10
|
* - EasyDNS (easydns.com)
|
11
|
* - DHS (www.dhs.org)
|
12
|
* - HN (hn.org) -- incomplete checking!
|
13
|
* - DynS (dyns.org)
|
14
|
* - ZoneEdit (zoneedit.com)
|
15
|
* - FreeDNS (freedns.afraid.org)
|
16
|
* - Loopia (loopia.se)
|
17
|
* - StaticCling (staticcling.org)
|
18
|
* - DNSexit (dnsexit.com)
|
19
|
* - OpenDNS (opendns.com)
|
20
|
* - Namecheap (namecheap.com)
|
21
|
* +----------------------------------------------------+
|
22
|
* Requirements:
|
23
|
* - PHP version 4.0.2 or higher with CURL Library
|
24
|
* +----------------------------------------------------+
|
25
|
* Public Functions
|
26
|
* - updatedns()
|
27
|
*
|
28
|
* Private Functions
|
29
|
* - _update()
|
30
|
* - _checkStatus()
|
31
|
* - _error()
|
32
|
* - _detectChange()
|
33
|
* - _debug()
|
34
|
* - _checkIP()
|
35
|
* +----------------------------------------------------+
|
36
|
* DynDNS Dynamic - Last Tested: 12 July 2005
|
37
|
* DynDNS Static - Last Tested: NEVER
|
38
|
* DynDNS Custom - Last Tested: NEVER
|
39
|
* No-IP - Last Tested: 20 July 2008
|
40
|
* HN.org - Last Tested: 12 July 2005
|
41
|
* EasyDNS - Last Tested: 20 July 2008
|
42
|
* DHS - Last Tested: 12 July 2005
|
43
|
* ZoneEdit - Last Tested: NEVER
|
44
|
* Dyns - Last Tested: NEVER
|
45
|
* ODS - Last Tested: 02 August 2005
|
46
|
* FreeDNS - Last Tested: NEVER
|
47
|
* Loopia - Last Tested: NEVER
|
48
|
* StaticCling - Last Tested: 27 April 2006
|
49
|
* DNSexit - Last Tested: 20 July 2008
|
50
|
* OpenDNS - Last Tested: 4 August 2008
|
51
|
* Namecheap - Last Tested: 31 August 2010
|
52
|
* +====================================================+
|
53
|
*
|
54
|
* @author E.Kristensen
|
55
|
* @link http://www.idylldesigns.com/projects/phpdns/
|
56
|
* @version 0.8
|
57
|
* @updated 13 October 05 at 21:02:42 GMT
|
58
|
*
|
59
|
* DNSexit/OpenDNS support and multiwan extension for pfSense by Ermal Lu?i
|
60
|
*
|
61
|
*/
|
62
|
|
63
|
class updatedns {
|
64
|
var $_cacheFile;
|
65
|
var $_debugFile;
|
66
|
var $_UserAgent = 'User-Agent: phpDynDNS/0.7';
|
67
|
var $_errorVerbosity = 0;
|
68
|
var $_dnsService;
|
69
|
var $_dnsUser;
|
70
|
var $_dnsPass;
|
71
|
var $_dnsHost;
|
72
|
var $_dnsIP;
|
73
|
/* This is needed for support on addresses behind NAT. */
|
74
|
var $_ifIP;
|
75
|
var $_dnsWildcard;
|
76
|
var $_dnsMX;
|
77
|
var $_dnsBackMX;
|
78
|
var $_dnsServer;
|
79
|
var $_dnsPort;
|
80
|
var $_dnsUpdateURL;
|
81
|
var $status;
|
82
|
var $_debugID;
|
83
|
var $_if;
|
84
|
|
85
|
/*
|
86
|
* Public Constructor Function (added 12 July 05) [beta]
|
87
|
* - Gets the dice rolling for the update.
|
88
|
*/
|
89
|
function updatedns ($dnsService = '', $dnsHost = '', $dnsUser = '', $dnsPass = '',
|
90
|
$dnsWildcard = 'OFF', $dnsMX = '', $dnsIf = '', $dnsBackMX = '',
|
91
|
$dnsServer = '', $dnsPort = '', $dnsUpdateURL = '') {
|
92
|
|
93
|
global $config, $g;
|
94
|
|
95
|
$this->_cacheFile = "{$g['conf_path']}/dyndns_{$dnsIf}{$dnsService}.cache";
|
96
|
$this->_debugFile = "{$g['varetc_path']}/dyndns_{$dnsIf}{$dnsService}.debug";
|
97
|
|
98
|
log_error("DynDns: updatedns() starting");
|
99
|
|
100
|
if (!$dnsService) $this->_error(2);
|
101
|
switch ($dnsService) {
|
102
|
case 'freedns':
|
103
|
if (!$dnsHost) $this->_error(5);
|
104
|
break;
|
105
|
case 'namecheap':
|
106
|
if (!$dnsPass) $this->_error(4);
|
107
|
if (!$dnsHost) $this->_error(5);
|
108
|
break;
|
109
|
default:
|
110
|
if (!$dnsUser) $this->_error(3);
|
111
|
if (!$dnsPass) $this->_error(4);
|
112
|
if (!$dnsHost) $this->_error(5);
|
113
|
}
|
114
|
|
115
|
$this->_dnsService = strtolower($dnsService);
|
116
|
$this->_dnsUser = $dnsUser;
|
117
|
$this->_dnsPass = $dnsPass;
|
118
|
$this->_dnsHost = $dnsHost;
|
119
|
$this->_dnsServer = $dnsServer;
|
120
|
$this->_dnsPort = $dnsPort;
|
121
|
$this->_dnsWildcard = $dnsWildcard;
|
122
|
$this->_dnsMX = $dnsMX;
|
123
|
$this->_if = get_real_interface($dnsIf);
|
124
|
$this->_ifIP = get_interface_ip($dnsIf);
|
125
|
//$this->_dnsIP = get_interface_ip($dnsIf);
|
126
|
|
127
|
// Ensure that we where able to lookup the IP
|
128
|
if(!$this->_ifIP)
|
129
|
log_error("There was an error trying to determine the IP for interface - {$dnsIf}({$this->_if}).");
|
130
|
|
131
|
$this->_debugID = rand(1000000, 9999999);
|
132
|
|
133
|
if ($this->_detectChange() == false) {
|
134
|
$this->_error(10);
|
135
|
} else {
|
136
|
switch ($this->_dnsService) {
|
137
|
case 'dnsomatic':
|
138
|
case 'dyndns':
|
139
|
case 'dyndns-static':
|
140
|
case 'dyndns-custom':
|
141
|
case 'dhs':
|
142
|
case 'noip':
|
143
|
case 'easydns':
|
144
|
case 'hn':
|
145
|
case 'zoneedit':
|
146
|
case 'dyns':
|
147
|
case 'ods':
|
148
|
case 'freedns':
|
149
|
case 'loopia':
|
150
|
case 'staticcling':
|
151
|
case 'dnsexit':
|
152
|
case 'opendns':
|
153
|
case 'namecheap':
|
154
|
$this->_update();
|
155
|
break;
|
156
|
default:
|
157
|
$this->_error(6);
|
158
|
break;
|
159
|
}
|
160
|
}
|
161
|
}
|
162
|
|
163
|
/*
|
164
|
* Private Function (added 12 July 05) [beta]
|
165
|
* Send Update To Selected Service.
|
166
|
*/
|
167
|
function _update() {
|
168
|
|
169
|
log_error("DynDns: DynDns _update() starting.");
|
170
|
|
171
|
if ($this->_dnsService != 'ods') {
|
172
|
$ch = curl_init();
|
173
|
curl_setopt($ch, CURLOPT_HEADER, 0);
|
174
|
curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent);
|
175
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
176
|
curl_setopt($ch, CURLOPT_INTERFACE, $this->_ifIP);
|
177
|
curl_setopt($ch, CURLOPT_TIMEOUT, 30); // Completely empirical
|
178
|
}
|
179
|
|
180
|
switch ($this->_dnsService) {
|
181
|
case 'dyndns':
|
182
|
case 'dyndns-static':
|
183
|
case 'dyndns-custom':
|
184
|
$needsIP = FALSE;
|
185
|
//log_error("DynDns: DynDns _update() starting. Dynamic");
|
186
|
if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") $this->_dnsWildcard = "ON";
|
187
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
188
|
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
|
189
|
$server = "https://members.dyndns.org/nic/update";
|
190
|
$port = "";
|
191
|
if($this->_dnsServer)
|
192
|
$server = $this->_dnsServer;
|
193
|
if($this->_dnsPort)
|
194
|
$port = ":" . $this->_dnsPort;
|
195
|
curl_setopt($ch, CURLOPT_URL, $server .$port . '?system=dyndns&hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard='.$this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NO');
|
196
|
$data = curl_exec($ch);
|
197
|
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
|
198
|
curl_close($ch);
|
199
|
$this->_checkStatus($data);
|
200
|
break;
|
201
|
case 'dhs':
|
202
|
$needsIP = TRUE;
|
203
|
$post_data['hostscmd'] = 'edit';
|
204
|
$post_data['hostscmdstage'] = '2';
|
205
|
$post_data['type'] = '4';
|
206
|
$post_data['updatetype'] = 'Online';
|
207
|
$post_data['mx'] = $this->_dnsMX;
|
208
|
$post_data['mx2'] = '';
|
209
|
$post_data['txt'] = '';
|
210
|
$post_data['offline_url'] = '';
|
211
|
$post_data['cloak'] = 'Y';
|
212
|
$post_data['cloak_title'] = '';
|
213
|
$post_data['ip'] = $this->_dnsIP;
|
214
|
$post_data['domain'] = 'dyn.dhs.org';
|
215
|
$post_data['hostname'] = $this->_dnsHost;
|
216
|
$post_data['submit'] = 'Update';
|
217
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
218
|
$server = "https://members.dhs.org/nic/hosts";
|
219
|
$port = "";
|
220
|
if($this->_dnsServer)
|
221
|
$server = $this->_dnsServer;
|
222
|
if($this->_dnsPort)
|
223
|
$port = ":" . $this->_dnsPort;
|
224
|
curl_setopt($ch, CURLOPT_URL, '{$server}{$port}');
|
225
|
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
|
226
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
|
227
|
$data = curl_exec($ch);
|
228
|
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
|
229
|
curl_close($ch);
|
230
|
$this->_checkStatus($data);
|
231
|
break;
|
232
|
case 'noip':
|
233
|
$needsIP = TRUE;
|
234
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
235
|
$server = "http://dynupdate.no-ip.com/ducupdate.php";
|
236
|
$port = "";
|
237
|
if($this->_dnsServer)
|
238
|
$server = $this->_dnsServer;
|
239
|
if($this->_dnsPort)
|
240
|
$port = ":" . $this->_dnsPort;
|
241
|
curl_setopt($ch, CURLOPT_URL, $server . $port . '?username=' . urlencode($this->_dnsUser) . '&pass=' . urlencode($this->_dnsPass) . '&hostname=' . $this->_dnsHost.'&ip=' . $this->_dnsIP);
|
242
|
$data = curl_exec($ch);
|
243
|
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
|
244
|
curl_close($ch);
|
245
|
$this->_checkStatus($data);
|
246
|
break;
|
247
|
case 'easydns':
|
248
|
$needsIP = TRUE;
|
249
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
250
|
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
|
251
|
$server = "http://members.easydns.com/dyn/dyndns.php";
|
252
|
$port = "";
|
253
|
if($this->_dnsServer)
|
254
|
$server = $this->_dnsServer;
|
255
|
if($this->_dnsPort)
|
256
|
$port = ":" . $this->_dnsPort;
|
257
|
curl_setopt($ch, CURLOPT_URL, $server . $port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard=' . $this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=' . $this->_dnsBackMX);
|
258
|
$data = curl_exec($ch);
|
259
|
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
|
260
|
curl_close($ch);
|
261
|
$this->_checkStatus($data);
|
262
|
break;
|
263
|
case 'hn':
|
264
|
$needsIP = TRUE;
|
265
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
266
|
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
|
267
|
$server = "http://dup.hn.org/vanity/update";
|
268
|
$port = "";
|
269
|
if($this->_dnsServer)
|
270
|
$server = $this->_dnsServer;
|
271
|
if($this->_dnsPort)
|
272
|
$port = ":" . $this->_dnsPort;
|
273
|
curl_setopt($ch, CURLOPT_URL, $server . $port . '?ver=1&IP=' . $this->_dnsIP);
|
274
|
$data = curl_exec($ch);
|
275
|
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
|
276
|
curl_close($ch);
|
277
|
$this->_checkStatus($data);
|
278
|
break;
|
279
|
case 'zoneedit':
|
280
|
$needsIP = FALSE;
|
281
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
282
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
283
|
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
|
284
|
|
285
|
$server = "https://dynamic.zoneedit.com/auth/dynamic.html";
|
286
|
$port = "";
|
287
|
if($this->_dnsServer)
|
288
|
$server = $this->_dnsServer;
|
289
|
if($this->_dnsPort)
|
290
|
$port = ":" . $this->_dnsPort;
|
291
|
curl_setopt($ch, CURLOPT_URL, "{$server}{$port}?host=" .$this->_dnsHost);
|
292
|
|
293
|
$data = curl_exec($ch);
|
294
|
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
|
295
|
curl_close($ch);
|
296
|
$this->_checkStatus($data);
|
297
|
break;
|
298
|
case 'dyns':
|
299
|
$needsIP = FALSE;
|
300
|
$server = "http://www.dyns.cx/postscript011.php";
|
301
|
$port = "";
|
302
|
if($this->_dnsServer)
|
303
|
$server = $this->_dnsServer;
|
304
|
if($this->_dnsPort)
|
305
|
$port = ":" . $this->_dnsPort;
|
306
|
curl_setopt($ch, CURLOPT_URL, $server . $port . '?username=' . urlencode($this->_dnsUser) . '&password=' . $this->_dnsPass . '&host=' . $this->_dnsHost);
|
307
|
$data = curl_exec($ch);
|
308
|
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
|
309
|
curl_close($ch);
|
310
|
$this->_checkStatus($data);
|
311
|
break;
|
312
|
case 'ods':
|
313
|
$needsIP = FALSE;
|
314
|
$misc_errno = 0;
|
315
|
$misc_error = "";
|
316
|
$server = "ods.org";
|
317
|
$port = "";
|
318
|
if($this->_dnsServer)
|
319
|
$server = $this->_dnsServer;
|
320
|
if($this->_dnsPort)
|
321
|
$port = ":" . $this->_dnsPort;
|
322
|
$this->con['socket'] = fsockopen("{$server}{$port}", "7070", $misc_errno, $misc_error, 30);
|
323
|
/* Check that we have connected */
|
324
|
if (!$this->con['socket']) {
|
325
|
print "error! could not connect.";
|
326
|
break;
|
327
|
}
|
328
|
/* Here is the loop. Read the incoming data (from the socket connection) */
|
329
|
while (!feof($this->con['socket'])) {
|
330
|
$this->con['buffer']['all'] = trim(fgets($this->con['socket'], 4096));
|
331
|
$code = substr($this->con['buffer']['all'], 0, 3);
|
332
|
sleep(1);
|
333
|
switch($code) {
|
334
|
case 100:
|
335
|
fputs($this->con['socket'], "LOGIN ".$this->_dnsUser." ".$this->_dnsPass."\n");
|
336
|
break;
|
337
|
case 225:
|
338
|
fputs($this->con['socket'], "DELRR ".$this->_dnsHost." A\n");
|
339
|
break;
|
340
|
case 901:
|
341
|
fputs($this->con['socket'], "ADDRR ".$this->_dnsHost." A ".$this->_dnsIP."\n");
|
342
|
break;
|
343
|
case 795:
|
344
|
fputs($this->con['socket'], "QUIT\n");
|
345
|
break;
|
346
|
}
|
347
|
}
|
348
|
$this->_checkStatus($code);
|
349
|
break;
|
350
|
case 'freedns':
|
351
|
$needIP = FALSE;
|
352
|
curl_setopt($ch, CURLOPT_URL, 'http://freedns.afraid.org/dynamic/update.php?' . $this->_dnsHost);
|
353
|
$data = curl_exec($ch);
|
354
|
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
|
355
|
curl_close($ch);
|
356
|
$this->_checkStatus($data);
|
357
|
break;
|
358
|
case 'dnsexit':
|
359
|
$needsIP = TRUE;
|
360
|
curl_setopt($ch, CURLOPT_URL, 'http://www.dnsexit.com/RemoteUpdate.sv?login='.$this->_dnsUser. '&password='.$this->_dnsPass.'&host='.$this->_dnsHost.'&myip='.$this->_dnsIP);
|
361
|
$data = curl_exec($ch);
|
362
|
if (@curl_error($ch)) log_error("Curl error occurred:" . curl_error($ch));
|
363
|
curl_close($ch);
|
364
|
$this->_checkStatus($data);
|
365
|
break;
|
366
|
case 'loopia':
|
367
|
$needsIP = TRUE;
|
368
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
369
|
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
|
370
|
curl_setopt($ch, CURLOPT_URL, 'https://dns.loopia.se/XDynDNSServer/XDynDNS.php?hostname='.$this->_dnsHost.'&myip='.$this->_dnsIP);
|
371
|
$data = curl_exec($ch);
|
372
|
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
|
373
|
curl_close($ch);
|
374
|
$this->_checkStatus($data);
|
375
|
break;
|
376
|
case 'opendns':
|
377
|
$needsIP = FALSE;
|
378
|
if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") $this->_dnsWildcard = "ON";
|
379
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
380
|
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
|
381
|
$server = "https://updates.opendns.com/nic/update?hostname=". $this->_dnsHost;
|
382
|
$port = "";
|
383
|
if($this->_dnsServer)
|
384
|
$server = $this->_dnsServer;
|
385
|
if($this->_dnsPort)
|
386
|
$port = ":" . $this->_dnsPort;
|
387
|
curl_setopt($ch, CURLOPT_URL, $server .$port);
|
388
|
$data = curl_exec($ch);
|
389
|
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
|
390
|
curl_close($ch);
|
391
|
$this->_checkStatus($data);
|
392
|
break;
|
393
|
|
394
|
case 'staticcling':
|
395
|
$needsIP = FALSE;
|
396
|
curl_setopt($ch, CURLOPT_URL, 'http://www.staticcling.org/update.html?login='.$this->_dnsUser.'&pass='.$this->_dnsPass);
|
397
|
$data = curl_exec($ch);
|
398
|
if (@curl_error($ch)) log_error("Curl error occured: " . curl_error($ch));
|
399
|
curl_close($ch);
|
400
|
$this->_checkStatus($data);
|
401
|
break;
|
402
|
case 'dnsomatic':
|
403
|
/* Example syntax
|
404
|
https://username:password@updates.dnsomatic.com/nic/update?hostname=yourhostname&myip=ipaddress&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG
|
405
|
*/
|
406
|
$needsIP = FALSE;
|
407
|
log_error("DNS-O-Matic: DNS update() starting.");
|
408
|
if (isset($this->_dnsWildcard) && $this->_dnsWildcard != "OFF") $this->_dnsWildcard = "ON";
|
409
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
410
|
curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
|
411
|
$server = "https://" . $this->_dnsUser . ":" . $this->_dnsPass . "@updates.dnsomatic.com/nic/update?hostname=";
|
412
|
if($this->_dnsServer)
|
413
|
$server = $this->_dnsServer;
|
414
|
if($this->_dnsPort)
|
415
|
$port = ":" . $this->_dnsPort;
|
416
|
curl_setopt($ch, CURLOPT_URL, $server . $this->_dnsHost . '&myip=' . $this->_dnsIP . '&wildcard='.$this->_dnsWildcard . '&mx=' . $this->_dnsMX . '&backmx=NOCHG');
|
417
|
$data = curl_exec($ch);
|
418
|
if (@curl_error($ch)) log_error("Request completed. DNS-O-Matic reported: " . curl_error($ch));
|
419
|
curl_close($ch);
|
420
|
$this->_checkStatus($data);
|
421
|
break;
|
422
|
case 'namecheap':
|
423
|
/* Example:
|
424
|
https://dynamicdns.park-your-domain.com/update?host=[host_name]&domain=[domain.com]&password=[domain_password]&ip=[your_ip]
|
425
|
*/
|
426
|
$needsIP = FALSE;
|
427
|
log_error("Namecheap: DNS update() starting.");
|
428
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
429
|
list($hostname, $domain) = explode(".", $this->_dnsHost, 2);
|
430
|
$server = "https://dynamicdns.park-your-domain.com/update?host={$hostname}&domain={$domain}&password={$this->_dnsPass}&ip={$this->_dnsIP}";
|
431
|
curl_setopt($ch, CURLOPT_URL, $server);
|
432
|
$data = curl_exec($ch);
|
433
|
if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
|
434
|
curl_close($ch);
|
435
|
$this->_checkStatus($data);
|
436
|
default:
|
437
|
break;
|
438
|
}
|
439
|
}
|
440
|
|
441
|
/*
|
442
|
* Private Function (added 12 July 2005) [beta]
|
443
|
* Retrieve Update Status
|
444
|
*/
|
445
|
function _checkStatus($data) {
|
446
|
log_error("DynDns: DynDns _checkStatus() starting.");
|
447
|
log_error("DynDns: Current Service: {$this->_dnsService}");
|
448
|
$successful_update = false;
|
449
|
switch ($this->_dnsService) {
|
450
|
case 'dnsomatic':
|
451
|
if (preg_match('/badauth/i', $data)) {
|
452
|
$status = "DNS-O-Matic: The DNS-O-Matic username or password specified are incorrect. No updates will be distributed to services until this is resolved.";
|
453
|
} else if (preg_match('/notfqdn /i', $data)) {
|
454
|
$status = "DNS-O-Matic: The hostname specified is not a fully-qualified domain name. If no hostnames included, notfqdn will be returned once.";
|
455
|
} else if (preg_match('/nohost/i', $data)) {
|
456
|
$status = "DNS-O-Matic: The hostname passed could not be matched to any services configured. The service field will be blank in the return code.";
|
457
|
} else if (preg_match('/numhost/i', $data)) {
|
458
|
$status = "DNS-O-Matic: You may update up to 20 hosts. numhost is returned if you try to update more than 20 or update a round-robin.";
|
459
|
} else if (preg_match('/abuse/i', $data)) {
|
460
|
$status = "DNS-O-Matic: The hostname is blocked for update abuse.";
|
461
|
} else if (preg_match('/good/i', $data)) {
|
462
|
$status = "DNS-O-Matic: (Success) IP Address Changed Successfully! (".$this->_dnsIP.")";
|
463
|
$successful_update = true;
|
464
|
} else if (preg_match('/dnserr/i', $data)) {
|
465
|
$status = "DNS-O-Matic: DNS error encountered. Stop updating for 30 minutes.";
|
466
|
} else {
|
467
|
$status = "DNS-O-Matic: (Unknown Response)";
|
468
|
log_error("DNS-O-Matic: PAYLOAD: {$data}");
|
469
|
$this->_debug($data);
|
470
|
}
|
471
|
break;
|
472
|
case 'dyndns':
|
473
|
if (preg_match('/notfqdn/i', $data)) {
|
474
|
$status = "phpDynDNS: (Error) Not A FQDN!";
|
475
|
} else if (preg_match('/nochg/i', $data)) {
|
476
|
$status = "phpDynDNS: (Success) No Change In IP Address";
|
477
|
$successful_update = true;
|
478
|
} else if (preg_match('/good/i', $data)) {
|
479
|
$status = "phpDynDNS: (Success) IP Address Changed Successfully! (".$this->_dnsIP.")";
|
480
|
$successful_update = true;
|
481
|
} else if (preg_match('/noauth/i', $data)) {
|
482
|
$status = "phpDynDNS: (Error) User Authorization Failed";
|
483
|
} else {
|
484
|
$status = "phpDynDNS: (Unknown Response)";
|
485
|
log_error("phpDynDNS: PAYLOAD: {$data}");
|
486
|
$this->_debug($data);
|
487
|
}
|
488
|
break;
|
489
|
case 'dyndns-static':
|
490
|
if (preg_match('/notfqdn/i', $data)) {
|
491
|
$status = "phpDynDNS: (Error) Not A FQDN!";
|
492
|
} else if (preg_match('/nochg/i', $data)) {
|
493
|
$status = "phpDynDNS: (Success) No Change In IP Address";
|
494
|
$successful_update = true;
|
495
|
} else if (preg_match('/good/i', $data)) {
|
496
|
$status = "phpDynDNS: (Success) IP Address Changed Successfully!";
|
497
|
$successful_update = true;
|
498
|
} else if (preg_match('/noauth/i', $data)) {
|
499
|
$status = "phpDynDNS: (Error) User Authorization Failed";
|
500
|
} else {
|
501
|
$status = "phpDynDNS: (Unknown Response)";
|
502
|
log_error("phpDynDNS: PAYLOAD: {$data}");
|
503
|
$this->_debug($data);
|
504
|
}
|
505
|
break;
|
506
|
case 'dyndns-custom':
|
507
|
if (preg_match('/notfqdn/i', $data)) {
|
508
|
$status = "phpDynDNS: (Error) Not A FQDN!";
|
509
|
} else if (preg_match('/nochg/i', $data)) {
|
510
|
$status = "phpDynDNS: (Success) No Change In IP Address";
|
511
|
$successful_update = true;
|
512
|
} else if (preg_match('/good/i', $data)) {
|
513
|
$status = "phpDynDNS: (Success) IP Address Changed Successfully!";
|
514
|
$successful_update = true;
|
515
|
} else if (preg_match('/noauth/i', $data)) {
|
516
|
$status = "phpDynDNS: (Error) User Authorization Failed";
|
517
|
} else {
|
518
|
$status = "phpDynDNS: (Unknown Response)";
|
519
|
log_error("phpDynDNS: PAYLOAD: {$data}");
|
520
|
$this->_debug($data);
|
521
|
}
|
522
|
break;
|
523
|
case 'dhs':
|
524
|
break;
|
525
|
case 'noip':
|
526
|
list($ip,$code) = split(":",$data);
|
527
|
switch ($code) {
|
528
|
case 0:
|
529
|
$status = "phpDynDNS: (Success) IP address is current, no update performed.";
|
530
|
$successful_update = true;
|
531
|
break;
|
532
|
case 1:
|
533
|
$status = "phpDynDNS: (Success) DNS hostname update successful.";
|
534
|
$successful_update = true;
|
535
|
break;
|
536
|
case 2:
|
537
|
$status = "phpDynDNS: (Error) Hostname supplied does not exist.";
|
538
|
break;
|
539
|
case 3:
|
540
|
$status = "phpDynDNS: (Error) Invalid Username.";
|
541
|
break;
|
542
|
case 4:
|
543
|
$status = "phpDynDNS: (Error) Invalid Password.";
|
544
|
break;
|
545
|
case 5:
|
546
|
$status = "phpDynDNS: (Error) To many updates sent.";
|
547
|
break;
|
548
|
case 6:
|
549
|
$status = "phpDynDNS: (Error) Account disabled due to violation of No-IP terms of service.";
|
550
|
break;
|
551
|
case 7:
|
552
|
$status = "phpDynDNS: (Error) Invalid IP. IP Address submitted is improperly formatted or is a private IP address or is on a blacklist.";
|
553
|
break;
|
554
|
case 8:
|
555
|
$status = "phpDynDNS: (Error) Disabled / Locked Hostname.";
|
556
|
break;
|
557
|
case 9:
|
558
|
$status = "phpDynDNS: (Error) Host updated is configured as a web redirect and no update was performed.";
|
559
|
break;
|
560
|
case 10:
|
561
|
$status = "phpDynDNS: (Error) Group supplied does not exist.";
|
562
|
break;
|
563
|
case 11:
|
564
|
$status = "phpDynDNS: (Success) DNS group update is successful.";
|
565
|
$successful_update = true;
|
566
|
break;
|
567
|
case 12:
|
568
|
$status = "phpDynDNS: (Success) DNS group is current, no update performed.";
|
569
|
$successful_update = true;
|
570
|
break;
|
571
|
case 13:
|
572
|
$status = "phpDynDNS: (Error) Update client support not available for supplied hostname or group.";
|
573
|
break;
|
574
|
case 14:
|
575
|
$status = "phpDynDNS: (Error) Hostname supplied does not have offline settings configured.";
|
576
|
break;
|
577
|
case 99:
|
578
|
$status = "phpDynDNS: (Error) Client disabled. Client should exit and not perform any more updates without user intervention.";
|
579
|
break;
|
580
|
case 100:
|
581
|
$status = "phpDynDNS: (Error) Client disabled. Client should exit and not perform any more updates without user intervention.";
|
582
|
break;
|
583
|
default:
|
584
|
$status = "phpDynDNS: (Unknown Response)";
|
585
|
$this->_debug("Unknown Response: ".$data);
|
586
|
break;
|
587
|
}
|
588
|
break;
|
589
|
case 'easydns':
|
590
|
if (preg_match('/NOACCESS/i', $data)) {
|
591
|
$status = "phpDynDNS: (Error) Authentication Failed: Username and/or Password was Incorrect.";
|
592
|
} else if (preg_match('/NOSERVICE/i', $data)) {
|
593
|
$status = "phpDynDNS: (Error) No Service: Dynamic DNS Service has been disabled for this domain.";
|
594
|
} else if (preg_match('/ILLEGAL INPUT/i', $data)) {
|
595
|
$status = "phpDynDNS: (Error) Illegal Input: Self-Explantory";
|
596
|
} else if (preg_match('/TOOSOON/i', $data)) {
|
597
|
$status = "phpDynDNS: (Error) Too Soon: Not Enough Time Has Elapsed Since Last Update";
|
598
|
} else if (preg_match('/NOERROR/i', $data)) {
|
599
|
$status = "phpDynDNS: (Success) IP Updated Successfully!";
|
600
|
$successful_update = true;
|
601
|
} else {
|
602
|
$status = "phpDynDNS: (Unknown Response)";
|
603
|
log_error("phpDynDNS: PAYLOAD: {$data}");
|
604
|
$this->_debug($data);
|
605
|
}
|
606
|
break;
|
607
|
case 'hn':
|
608
|
/* FIXME: add checks */
|
609
|
break;
|
610
|
case 'zoneedit':
|
611
|
if (preg_match('/799/i', $data)) {
|
612
|
$status = "phpDynDNS: (Error 799) Update Failed!";
|
613
|
} else if (preg_match('/700/i', $data)) {
|
614
|
$status = "phpDynDNS: (Error 700) Update Failed!";
|
615
|
} else if (preg_match('/200/i', $data)) {
|
616
|
$status = "phpDynDNS: (Success) IP Address Updated Successfully!";
|
617
|
$successful_update = true;
|
618
|
} else if (preg_match('/201/i', $data)) {
|
619
|
$status = "phpDynDNS: (Success) IP Address Updated Successfully!";
|
620
|
$successful_update = true;
|
621
|
} else {
|
622
|
$status = "phpDynDNS: (Unknown Response)";
|
623
|
log_error("phpDynDNS: PAYLOAD: {$data}");
|
624
|
$this->_debug($data);
|
625
|
}
|
626
|
break;
|
627
|
case 'dyns':
|
628
|
if (preg_match("/400/i", $data)) {
|
629
|
$status = "phpDynDNS: (Error) Bad Request - The URL was malformed. Required parameters were not provided.";
|
630
|
} else if (preg_match('/402/i', $data)) {
|
631
|
$status = "phpDynDNS: (Error) Update Too Soon - You have tried updating to quickly since last change.";
|
632
|
} else if (preg_match('/403/i', $data)) {
|
633
|
$status = "phpDynDNS: (Error) Database Error - There was a server-sided database error.";
|
634
|
} else if (preg_match('/405/i', $data)) {
|
635
|
$status = "phpDynDNS: (Error) Hostname Error - The hostname (".$this->_dnsHost.") doesn't belong to you.";
|
636
|
} else if (preg_match('/200/i', $data)) {
|
637
|
$status = "phpDynDNS: (Success) IP Address Updated Successfully!";
|
638
|
$successful_update = true;
|
639
|
} else {
|
640
|
$status = "phpDynDNS: (Unknown Response)";
|
641
|
log_error("phpDynDNS: PAYLOAD: {$data}");
|
642
|
$this->_debug($data);
|
643
|
}
|
644
|
break;
|
645
|
case 'ods':
|
646
|
if (preg_match("/299/i", $data)) {
|
647
|
$status = "phpDynDNS: (Success) IP Address Updated Successfully!";
|
648
|
$successful_update = true;
|
649
|
} else {
|
650
|
$status = "phpDynDNS: (Unknown Response)";
|
651
|
log_error("phpDynDNS: PAYLOAD: {$data}");
|
652
|
$this->_debug($data);
|
653
|
}
|
654
|
break;
|
655
|
case 'freedns':
|
656
|
if (preg_match("/has not changed./i", $data)) {
|
657
|
$status = "phpDynDNS: (Success) No Change In IP Address";
|
658
|
$successful_update = true;
|
659
|
} else if (preg_match("/Updated/i", $data)) {
|
660
|
$status = "phpDynDNS: (Success) IP Address Changed Successfully!";
|
661
|
$successful_update = true;
|
662
|
} else {
|
663
|
$status = "phpDynDNS: (Unknown Response)";
|
664
|
log_error("phpDynDNS: PAYLOAD: {$data}");
|
665
|
$this->_debug($data);
|
666
|
}
|
667
|
break;
|
668
|
case 'dnsexit':
|
669
|
if (preg_match("/is the same/i", $data)) {
|
670
|
$status = "phpDynDns: (Success) No Change In IP Address";
|
671
|
$successful_update = true;
|
672
|
} else if (preg_match("/Success/i", $data)) {
|
673
|
$status = "phpDynDNS: (Success) IP Address Changed Successfully!";
|
674
|
$successful_update = true;
|
675
|
} else {
|
676
|
$status = "phpDynDNS: (Unknown Response)";
|
677
|
log_error("phpDynDNS: PAYLOAD: {$data}");
|
678
|
$this->_debug($data);
|
679
|
}
|
680
|
break;
|
681
|
case 'loopia':
|
682
|
if (preg_match("/nochg/i", $data)) {
|
683
|
$status = "phpDynDNS: (Success) No Change In IP Address";
|
684
|
$successful_update = true;
|
685
|
} else if (preg_match("/good/i", $data)) {
|
686
|
$status = "phpDynDNS: (Success) IP Address Changed Successfully!";
|
687
|
$successful_update = true;
|
688
|
} else if (preg_match('/badauth/i', $data)) {
|
689
|
$status = "phpDynDNS: (Error) User Authorization Failed";
|
690
|
} else {
|
691
|
$status = "phpDynDNS: (Unknown Response)";
|
692
|
log_error("phpDynDNS: PAYLOAD: {$data}");
|
693
|
$this->_debug($data);
|
694
|
}
|
695
|
break;
|
696
|
case 'opendns':
|
697
|
if (preg_match('/badauth/i', $data)) {
|
698
|
$status = "phpDynDNS: (Error) Not a valid username or password!";
|
699
|
} else if (preg_match('/nohost/i', $data)) {
|
700
|
$status = "phpDynDNS: (Error) Hostname you are trying to update does not exist.";
|
701
|
$successful_update = true;
|
702
|
} else if (preg_match('/good/i', $data)) {
|
703
|
$status = "phpDynDNS: (Success) IP Address Changed Successfully! (".$this->_dnsIP.")";
|
704
|
$successful_update = true;
|
705
|
} else if (preg_match('/yours/i', $data)) {
|
706
|
$status = "phpDynDNS: (Error) hostname specified exists, but not under the username specified.";
|
707
|
} else if (preg_match('/abuse/i', $data)) {
|
708
|
$status = "phpDynDns: (Error) Updating to frequently, considered abuse.";
|
709
|
} else {
|
710
|
$status = "phpDynDNS: (Unknown Response)";
|
711
|
log_error("phpDynDNS: PAYLOAD: {$data}");
|
712
|
$this->_debug($data);
|
713
|
}
|
714
|
break;
|
715
|
case 'staticcling':
|
716
|
if (preg_match("/invalid ip/i", $data)) {
|
717
|
$status = "phpDynDNS: (Error) Bad Request - The IP provided was invalid.";
|
718
|
} else if (preg_match('/required info missing/i', $data)) {
|
719
|
$status = "phpDynDNS: (Error) Bad Request - Required parameters were not provided.";
|
720
|
} else if (preg_match('/invalid characters/i', $data)) {
|
721
|
$status = "phpDynDNS: (Error) Bad Request - Illegal characters in either the username or the password.";
|
722
|
} else if (preg_match('/bad password/i', $data)) {
|
723
|
$status = "phpDynDNS: (Error) Invalid password.";
|
724
|
} else if (preg_match('/account locked/i', $data)) {
|
725
|
$status = "phpDynDNS: (Error) This account has been administratively locked.";
|
726
|
} else if (preg_match('/update too frequent/i', $data)) {
|
727
|
$status = "phpDynDNS: (Error) Updating too frequently.";
|
728
|
} else if (preg_match('/DB error/i', $data)) {
|
729
|
$status = "phpDynDNS: (Error) Server side error.";
|
730
|
} else if (preg_match('/success/i', $data)) {
|
731
|
$status = "phpDynDNS: (Success) IP Address Updated Successfully!";
|
732
|
$successful_update = true;
|
733
|
} else {
|
734
|
$status = "phpDynDNS: (Unknown Response)";
|
735
|
log_error("phpDynDNS: PAYLOAD: {$data}");
|
736
|
$this->_debug($data);
|
737
|
}
|
738
|
break;
|
739
|
case 'namecheap':
|
740
|
$tmp = str_replace("^M", "", $data);
|
741
|
$ncresponse = @xml2array($tmp);
|
742
|
if (preg_match("/internal server error/i", $data)) {
|
743
|
$status = "phpDynDNS: (Error) Server side error.";
|
744
|
} else if ($ncresponse['interface-response']['ErrCount'] === "0") {
|
745
|
$status = "phpDynDNS: (Success) IP Address Updated Successfully!";
|
746
|
$successful_update = true;
|
747
|
} else if (is_numeric($ncresponse['interface-response']['ErrCount']) && ($ncresponse['interface-response']['ErrCount'] > 0)) {
|
748
|
$status = "phpDynDNS: (Error) " . implode(", ", $ncresponse["interface-response"]["errors"]);
|
749
|
$successful_update = true;
|
750
|
} else {
|
751
|
$status = "phpDynDNS: (Unknown Response)";
|
752
|
log_error("phpDynDNS: PAYLOAD: {$data}");
|
753
|
$this->_debug($data);
|
754
|
}
|
755
|
break;
|
756
|
}
|
757
|
|
758
|
if($successful_update == true) {
|
759
|
/* Write WAN IP to cache file */
|
760
|
$wan_ip = $this->_checkIP();
|
761
|
$currentTime = time();
|
762
|
log_error("phpDynDNS: updating cache file {$this->_cacheFile}: {$wan_ip}");
|
763
|
conf_mount_rw();
|
764
|
$file = fopen($this->_cacheFile, 'w');
|
765
|
fwrite($file, $wan_ip.':'.$currentTime);
|
766
|
fclose($file);
|
767
|
conf_mount_ro();
|
768
|
}
|
769
|
$this->status = $status;
|
770
|
log_error($status);
|
771
|
}
|
772
|
|
773
|
/*
|
774
|
* Private Function (added 12 July 05) [beta]
|
775
|
* Return Error, Set Last Error, and Die.
|
776
|
*/
|
777
|
function _error($errorNumber = '1') {
|
778
|
switch ($errorNumber) {
|
779
|
case 0:
|
780
|
break;
|
781
|
case 2:
|
782
|
$error = 'phpDynDNS: (ERROR!) No Dynamic DNS Service provider was selected.';
|
783
|
break;
|
784
|
case 3:
|
785
|
$error = 'phpDynDNS: (ERROR!) No Username Provided.';
|
786
|
break;
|
787
|
case 4:
|
788
|
$error = 'phpDynDNS: (ERROR!) No Password Provided.';
|
789
|
break;
|
790
|
case 5:
|
791
|
$error = 'phpDynDNS: (ERROR!) No Hostname Provided.';
|
792
|
break;
|
793
|
case 6:
|
794
|
$error = 'phpDynDNS: (ERROR!) The Dynamic DNS Service provided is not yet supported.';
|
795
|
break;
|
796
|
case 7:
|
797
|
$error = 'phpDynDNS: (ERROR!) No Update URL Provided.';
|
798
|
break;
|
799
|
case 10:
|
800
|
$error = 'phpDynDNS: No change in my IP address and/or 25 days has not passed. Not updating dynamic DNS entry.';
|
801
|
break;
|
802
|
default:
|
803
|
$error = "phpDynDNS: (ERROR!) Unknown Response.";
|
804
|
/* FIXME: $data isn't in scope here */
|
805
|
/* $this->_debug($data); */
|
806
|
break;
|
807
|
}
|
808
|
$this->lastError = $error;
|
809
|
log_error($error);
|
810
|
}
|
811
|
|
812
|
/*
|
813
|
* Private Function (added 12 July 05) [beta]
|
814
|
* - Detect whether or not IP needs to be updated.
|
815
|
* | Written Specifically for pfSense (pfsense.com) may
|
816
|
* | work with other systems. pfSense base is FreeBSD.
|
817
|
*/
|
818
|
function _detectChange() {
|
819
|
|
820
|
log_error("DynDns: _detectChange() starting.");
|
821
|
|
822
|
$currentTime = time();
|
823
|
|
824
|
$wan_ip = $this->_checkIP();
|
825
|
$this->_dnsIP = $wan_ip;
|
826
|
log_error("DynDns: Current WAN IP: {$wan_ip}");
|
827
|
|
828
|
if (file_exists($this->_cacheFile)) {
|
829
|
if(file_exists($this->_cacheFile))
|
830
|
$contents = file_get_contents($this->_cacheFile);
|
831
|
else
|
832
|
$contents = "";
|
833
|
list($cacheIP,$cacheTime) = split(':', $contents);
|
834
|
$this->_debug($cacheIP.'/'.$cacheTime);
|
835
|
$initial = false;
|
836
|
log_error("DynDns: Cached IP: {$cacheIP}");
|
837
|
} else {
|
838
|
conf_mount_rw();
|
839
|
$file = fopen($this->_cacheFile, 'w');
|
840
|
fwrite($file, '0.0.0.0:'.$currentTime);
|
841
|
fclose($file);
|
842
|
conf_mount_ro();
|
843
|
$cacheIP = '0.0.0.0';
|
844
|
$cacheTime = $currentTime;
|
845
|
$initial = true;
|
846
|
log_error("DynDns: No Cached IP found.");
|
847
|
}
|
848
|
|
849
|
/* use 2419200 for dyndns, dhs, easydns, noip, hn
|
850
|
* zoneedit, dyns, ods
|
851
|
*/
|
852
|
$time = '2160000';
|
853
|
|
854
|
$needs_updating = FALSE;
|
855
|
/* lets determine if the item needs updating */
|
856
|
if ($cacheIP != $wan_ip) {
|
857
|
$needs_updating = true;
|
858
|
$update_reason = "DynDns: cacheIP != wan_ip. Updating. ";
|
859
|
$update_reason .= "Cached IP: {$cacheIP} WAN IP: {$wan_ip} ";
|
860
|
}
|
861
|
if (($currentTime - $cacheTime) > $time ) {
|
862
|
$needs_updating = true;
|
863
|
$update_reason = "DynDns: More than 25 days. Updating. ";
|
864
|
$update_reason .= "{$currentTime} - {$cacheTime} > {$time} ";
|
865
|
}
|
866
|
if ($initial == true) {
|
867
|
$needs_updating = true;
|
868
|
$update_reason .= "Inital update. ";
|
869
|
}
|
870
|
|
871
|
/* finally if we need updating then store the
|
872
|
* new cache value and return true
|
873
|
*/
|
874
|
if ($needs_updating == true) {
|
875
|
log_error("DynDns debug information: {$update_reason}");
|
876
|
return true;
|
877
|
}
|
878
|
|
879
|
return false;
|
880
|
}
|
881
|
|
882
|
/*
|
883
|
* Private Funcation (added 16 July 05) [beta]
|
884
|
* - Writes debug information to a file.
|
885
|
* - This function is only called when a unknown response
|
886
|
* - status is returned from a DynDNS service provider.
|
887
|
*/
|
888
|
function _debug ($data) {
|
889
|
$string = '\n'.date('m-d-y h:i:s').' - ('.$this->_debugID.') - ['.$this->_dnsService.'] - '.$data.'\n';
|
890
|
conf_mount_rw();
|
891
|
$file = fopen($this->_debugFile, 'a');
|
892
|
fwrite($file, $string);
|
893
|
fclose($file);
|
894
|
conf_mount_ro();
|
895
|
}
|
896
|
function _checkIP() {
|
897
|
|
898
|
log_error("DynDns: _checkIP() starting.");
|
899
|
|
900
|
$ip_address = find_interface_ip($this->_if);
|
901
|
$this->_ifIP = $ip_address;
|
902
|
if (is_private_ip($ip_address)) {
|
903
|
$hosttocheck = "checkip.dyndns.org";
|
904
|
$checkip = gethostbyname($hosttocheck);
|
905
|
$ip_ch = curl_init("http://{$checkip}");
|
906
|
curl_setopt($ip_ch, CURLOPT_RETURNTRANSFER, 1);
|
907
|
curl_setopt($ip_ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
908
|
curl_setopt($ip_ch, CURLOPT_INTERFACE, $ip_address);
|
909
|
$ip_result_page = curl_exec($ip_ch);
|
910
|
curl_close($ip_ch);
|
911
|
$ip_result_decoded = urldecode($ip_result_page);
|
912
|
preg_match('/Current IP Address: (.*)<\/body>/', $ip_result_decoded, $matches);
|
913
|
$ip_address = trim($matches[1]);
|
914
|
log_error("DynDns debug information: {$ip_address} extracted from {$hosttocheck}");
|
915
|
} else
|
916
|
log_error("DynDns debug information: {$ip_address} extracted from local system.");
|
917
|
|
918
|
return $ip_address;
|
919
|
}
|
920
|
|
921
|
}
|
922
|
|
923
|
?>
|