Project

General

Profile

Download (18.7 KB) Statistics
| Branch: | Tag: | Revision:
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)
13
	 *    - DynS (dyns.org)
14
	 *    - ZoneEdit (zoneedit.com)
15
	 * +----------------------------------------------------+
16
	 *  Requirements:
17
	 *    - PHP version 4.0.2 or higher with CURL Library
18
	 * +----------------------------------------------------+
19
	 *  Public Functions
20
	 *    - updatedns()
21
	 *
22
	 *  Private Functions
23
	 *    - _update()
24
	 *    - _checkStatus()
25
	 *    - _error()
26
	 *    - _detectChange()
27
	 *    - _debug()
28
	 * +----------------------------------------------------+
29
	 *  DynDNS Dynamic - Last Tested: 12 July 2005
30
	 *  DynDNS Static  - Last Tested: NEVER
31
	 *  DynDNS Custom  - Last Tested: NEVER
32
	 *  No-IP          - Last Tested: 12 July 2005
33
	 *  HN.org         - Last Tested: 12 July 2005
34
	 *  EasyDNS        - Last Tested: NEVER
35
	 *  DHS            - Last Tested: 12 July 2005
36
	 *  ZoneEdit       - Last Tested: NEVER
37
	 *  Dyns           - Last Tested: NEVER
38
	 *  ODS            - Last Tested: 02 August 2005
39
	 * +====================================================+
40
	 *
41
	 * @author 	E.Kristensen
42
	 * @link    	http://www.idylldesigns.com/projects/phpdns/
43
	 * @version 	0.8
44
	 * @updated	13 October 05 at 21:02:42 GMT
45
	 *
46
	 */
47

    
48
	class updatedns {
49
		var $_cacheFile = '/cf/conf/dyndns.cache';
50
		var $_debugFile = '/var/etc/dyndns.debug';
51
		var $_UserAgent = 'User-Agent: phpDynDNS/0.7';
52
		var $_errorVerbosity = 0;
53
		var $_dnsService;
54
		var $_dnsUser;
55
		var $_dnsPass;
56
		var $_dnsHost;
57
		var $_dnsIP;
58
		var $_dnsWildcard;
59
		var $_dnsMX;
60
		var $_dnsBackMX;
61
		var $status;
62
		var $_debugID;
63

    
64
		/* 
65
		 * Public Constructor Function (added 12 July 05) [beta]
66
		 *   - Gets the dice rolling for the update. 
67
		 */
68
		function updatedns ($dnsService = '', $dnsHost = '', $dnsUser = '', $dnsPass = '', $dnsWildcard = 'OFF', $dnsMX = '', $dnsBackMX = '') {
69
			global $config;
70

    
71
			log_error("DynDns: updatedns() starting");
72

    
73
			if (!$dnsService) $this->_error(2);
74
			if (!$dnsUser) $this->_error(3);
75
			if (!$dnsPass) $this->_error(4);
76
			if (!$dnsHost) $this->_error(5);
77

    
78
			$this->_dnsService = strtolower($dnsService);
79
			$this->_dnsUser = $dnsUser;
80
			$this->_dnsPass = $dnsPass;
81
			$this->_dnsHost = $dnsHost;
82
			$this->_dnsIP = $dnsIP;
83
			$this->_debugID = rand(1000000, 9999999);
84

    
85
			if ($this->_detectChange() == FALSE) {
86
				$this->_error(10);
87
			} else {
88
				if ($this->_dnsService == 'dyndns' ||
89
					$this->_dnsService == 'dyndns-static' ||
90
					$this->_dnsService == 'dyndns-custom' ||
91
					$this->_dnsService == 'dhs' ||
92
					$this->_dnsService == 'noip' ||
93
					$this->_dnsService == 'easydns' ||
94
					$this->_dnsService == 'hn' ||
95
					$this->_dnsService == 'zoneedit' ||
96
					$this->_dnsService == 'dyns' ||
97
					$this->_dnsService == 'ods')
98
				{
99
					$this->_update();
100
				} else {
101
					$this->_error(6);
102
				}
103
			}
104

    
105
		}
106

    
107
		/*
108
		 * Private Function (added 12 July 05) [beta]
109
		 *   Send Update To Selected Service.
110
		 */
111
		function _update() {
112
		
113
			log_error("DynDns: DynDns _update() starting.");
114
		
115
			if ($this->_dnsService != 'ods') {
116
				$ch = curl_init();
117
				curl_setopt($ch, CURLOPT_HEADER, 0);
118
				curl_setopt($ch, CURLOPT_USERAGENT, $this->_UserAgent);
119
				curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
120
				curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
121
			}
122

    
123
			switch ($this->_dnsService) {
124
				case 'dyndns':
125
					$needsIP = FALSE;
126
					curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
127
					curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
128
					curl_setopt($ch, CURLOPT_URL, 'https://members.dyndns.org/nic/update?hostname='.$this->_dnsHost.'&myip='.$this->_dnsIP.'&wildcard='.$this->_dnsWildcard.'&mx='.$this->_dnsMX.'&backmx=NO');
129
					$data = curl_exec($ch);
130
					curl_close($ch);
131
					$this->_checkStatus($data);
132
					break;
133
				case 'dyndns-static':
134
					$needsIP = FALSE;
135
					curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
136
					curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
137
					curl_setopt($ch, CURLOPT_URL, 'https://members.dyndns.org/nic/update?system=statdns&hostname='.$this->_dnsHost.'&myip='.$this->_dnsIP.'&wildcard='.$this->_dnsWildcard.'&mx='.$this->_dnsMX.'&backmx=NO');
138
					$data = curl_exec($ch);
139
					curl_close($ch);
140
					$this->_checkStatus($data);
141
					break;
142
				case 'dyndns-custom':
143
					$needsIP = FALSE;
144
					curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
145
					curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
146
					curl_setopt($ch, CURLOPT_URL, 'https://members.dyndns.org/nic/update?system=custom&hostname='.$this->_dnsHost.'&myip='.$this->_dnsIP.'&wildcard='.$this->_dnsWildcard.'&mx='.$this->_dnsMX.'&backmx=NO');
147
					$data = curl_exec($ch);
148
					curl_close($ch);
149
					$this->_checkStatus($data);
150
					break;
151
				case 'dhs':
152
					$needsIP = TRUE;
153
					$post_data['hostscmd'] = 'edit';
154
					$post_data['hostscmdstage'] = '2';
155
					$post_data['type'] = '4';
156
					$post_data['updatetype'] = 'Online';
157
					$post_data['mx'] = $this->_dnsMX;
158
					$post_data['mx2'] = '';
159
					$post_data['txt'] = '';
160
					$post_data['offline_url'] = '';
161
					$post_data['cloak'] = 'Y';
162
					$post_data['cloak_title'] = '';
163
					$post_data['ip'] = $this->_dnsIP;
164
					$post_data['domain'] = 'dyn.dhs.org';
165
					$post_data['hostname'] = $this->_dnsHost;
166
					$post_data['submit'] = 'Update';
167
					curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
168
					curl_setopt($ch, CURLOPT_URL, 'https://members.dhs.org/nic/hosts');
169
					curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
170
					curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
171
					$data = curl_exec($ch);
172
					curl_close($ch);
173
					$this->_checkStatus($data);
174
					break;
175
				case 'noip':
176
					$needsIP = TRUE;
177
					curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
178
					curl_setopt($ch, CURLOPT_URL, 'http://dynupdate.no-ip.com/dns?username='.$this->_dnsUser.'&password='.$this->_dnsPass.'&hostname='.$this->_dnsHost.'&ip='.$this->_dnsIP);
179
					$data = curl_exec($ch);
180
					curl_close($ch);
181
					$this->_checkStatus($data);
182
					break;
183
				case 'easydns':
184
					$needsIP = TRUE;
185
					curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
186
					curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
187
					curl_setopt($ch, CURLOPT_URL, 'http://members.easydns.com/dyn/dyndns.php?hostname='.$this->_dnsHost.'&myip='.$this->_dnsIP.'&wildcard='.$this->_dnsWildcard.'&mx='.$this->_dnsMX.'&backmx='.$this->_dnsBackMX);
188
					$data = curl_exec($ch);
189
					curl_close($ch);
190
					$this->_checkStatus($data);
191
					break;
192
				case 'hn':
193
					$needsIP = TRUE;
194
					curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
195
					curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
196
					curl_setopt($ch, CURLOPT_URL, 'http://dup.hn.org/vanity/update?ver=1&IP='.$this->_dnsIP);
197
					$data = curl_exec($ch);
198
					curl_close($ch);
199
					$this->_checkStatus($data);
200
					break;
201
				case 'zoneedit':
202
					$needsIP = FALSE;
203
					curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
204
					curl_setopt($ch, CURLOPT_URL, 'https://dynamic.zoneedit.com/auth/dynamic.html?host='.$this->_dnsHost.'&dnsto='.$this->_dnsIP);
205
					$data = curl_exec($ch);
206
					curl_close($ch);
207
					$this->_checkStatus($data);
208
					break;
209
				case 'dyns':
210
					$needsIP = FALSE;
211
					curl_setopt($ch, CURLOPT_URL, 'http://www.dyns.cx/postscript011.php?username='.$this->_dnsUser.'&password='.$this->_dnsPass.'&host='.$this->_dnsHost);
212
					$data = curl_exec($ch);
213
					curl_close($ch);
214
					$this->_checkStatus($data);
215
					break;
216
				case 'ods':
217
					$needsIP = FALSE;
218
					$this->con['socket'] = fsockopen("ods.org", "7070", $misc_errno, $misc_error, 30);
219
					/* Check that we have connected */
220
					if (!$this->con['socket']) {
221
						print "error! could not connect.";
222
						break;
223
					}
224
					/* Here is the loop. Read the incoming data (from the socket connection) */
225
					while (!feof($this->con['socket'])) {
226
						$this->con['buffer']['all'] = trim(fgets($this->con['socket'], 4096));
227
						$code = substr($this->con['buffer']['all'], 0, 3);
228
						sleep(1);
229
						switch($code) {
230
							case 100:
231
								fputs($this->con['socket'], "LOGIN ".$this->_dnsUser." ".$this->_dnsPass."\n");
232
								break;
233
							case 225:
234
								fputs($this->con['socket'], "DELRR ".$this->_dnsHost." A\n");
235
								break;
236
							case 901:
237
								fputs($this->con['socket'], "ADDRR ".$this->_dnsHost." A ".$this->_dnsIP."\n");
238
								break;
239
							case 795:
240
								fputs($this->con['socket'], "QUIT\n");
241
								break;
242
						}
243
					}
244
					$this->_checkStatus($code);
245
					break;
246
				default:
247
					break;
248
			}
249
		}
250

    
251
		/*
252
		 * Private Function (added 12 July 2005) [beta]
253
		 *   Retrieve Update Status
254
		 */
255
		function _checkStatus($data) {
256
			log_error("DynDns: DynDns _checkStatus() starting.");
257
			switch ($this->_dnsService) {
258
				case 'dyndns':
259
					if (preg_match('/notfqdn/i', $data)) {
260
						$status = "phpDynDNS: (Error) Not A FQDN!";
261
					} else if (preg_match('/nochg/i', $data)) {
262
						$status = "phpDynDNS: (Success) No Change In IP Address";
263
					} else if (preg_match('/good/i', $data)) {
264
						$status = "phpDynDNS: (Success) IP Address Changed Successfully! (".$this->_dnsIP.")";
265
					} else if (preg_match('/noauth/i', $data)) {
266
						$status = "phpDynDNS: (Error) User Authorization Failed";
267
					} else {
268
						$status = "phpDynDNS: (Unknown Response)";
269
						$this->_debug($data);
270
					}
271
					break;
272
				case 'dyndns-static':
273
					if (preg_match('/notfqdn/i', $data)) {
274
						$status = "phpDynDNS: (Error) Not A FQDN!";
275
					} else if (preg_match('/nochg/i', $data)) {
276
						$status = "phpDynDNS: (Success) No Change In IP Address";
277
					} else if (preg_match('/good/i', $data)) {
278
						$status = "phpDynDNS: (Success) IP Address Changed Successfully!";
279
					} else if (preg_match('/noauth/i', $data)) {
280
						$status = "phpDynDNS: (Error) User Authorization Failed";
281
					} else {
282
						$status = "phpDynDNS: (Unknown Response)";
283
						$this->_debug($data);
284
					}
285
					break;
286
				case 'dyndns-custom':
287
					if (preg_match('/notfqdn/i', $data)) {
288
						$status = "phpDynDNS: (Error) Not A FQDN!";
289
					} else if (preg_match('/nochg/i', $data)) {
290
						$status = "phpDynDNS: (Success) No Change In IP Address";
291
					} else if (preg_match('/good/i', $data)) {
292
						$status = "phpDynDNS: (Success) IP Address Changed Successfully!";
293
					} else if (preg_match('/noauth/i', $data)) {
294
						$status = "phpDynDNS: (Error) User Authorization Failed";
295
					} else {
296
						$status = "phpDynDNS: (Unknown Response)";
297
						$this->_debug($data);
298
					}
299
					break;
300
				case 'dhs':
301
					break;
302
				case 'noip':
303
					list($ip,$code) = split(":",$data);
304
					switch ($code) {
305
						case 0:
306
							$status = "phpDynDNS: (Success) IP address is current, no update performed.";
307
							break;
308
						case 1:
309
							$status = "phpDynDNS: (Success) DNS hostname update successful.";
310
							break;
311
						case 2:
312
							$status = "phpDynDNS: (Error) Hostname supplied does not exist.";
313
							break;
314
						case 3:
315
							$status = "phpDynDNS: (Error) Invalid Username.";
316
							break;
317
						case 4:
318
							$status = "phpDynDNS: (Error) Invalid Password.";
319
							break;
320
						case 5:
321
							$status = "phpDynDNS: (Error) To many updates sent.";
322
							break;
323
						case 6:
324
							$status = "phpDynDNS: (Error) Account disabled due to violation of No-IP terms of service.";
325
							break;
326
						case 7:
327
							$status = "phpDynDNS: (Error) Invalid IP. IP Address submitted is improperly formatted or is a private IP address or is on a blacklist.";
328
							break;
329
						case 8:
330
							$status = "phpDynDNS: (Error) Disabled / Locked Hostname.";
331
							break;
332
						case 9:
333
							$status = "phpDynDNS: (Error) Host updated is configured as a web redirect and no update was performed.";
334
							break;
335
						case 10:
336
							$status = "phpDynDNS: (Error) Group supplied does not exist.";
337
							break;
338
						case 11:
339
							$status = "phpDynDNS: (Success) DNS group update is successful.";
340
							break;
341
						case 12:
342
							$status = "phpDynDNS: (Success) DNS group is current, no update performed.";
343
							break;
344
						case 13:
345
							$status = "phpDynDNS: (Error) Update client support not available for supplied hostname or group.";
346
							break;
347
						case 14:
348
							$status = "phpDynDNS: (Error) Hostname supplied does not have offline settings configured.";
349
							break;
350
						case 99:
351
							$status = "phpDynDNS: (Error) Client disabled. Client should exit and not perform any more updates without user intervention.";
352
							break;
353
						case 100:
354
							$status = "phpDynDNS: (Error) Client disabled. Client should exit and not perform any more updates without user intervention.";
355
							break;
356
						default:
357
							$status = "phpDynDNS: (Unknown Response)";
358
							$this->_debug($data);
359
							break;
360
					}
361
					break;
362
				case 'easydns':
363
					if (preg_match('/NOACCESS/i', $data)) {
364
						$status = "phpDynDNS: (Error) Authentication Failed: Username and/or Password was Incorrect.";
365
					} else if (preg_match('/NOSERVICE/i', $data)) {
366
						$status = "phpDynDNS: (Error) No Service: Dynamic DNS Service has been disabled for this domain.";
367
					} else if (preg_match('/ILLEGAL INPUT/i', $data)) {
368
						$status = "phpDynDNS: (Error) Illegal Input: Self-Explantory";
369
					} else if (preg_match('/TOOSOON/i', $data)) {
370
						$status = "phpDynDNS: (Error) Too Soon: Not Enough Time Has Elapsed Since Last Update";
371
					} else if (preg_match('/NOERROR/i', $data)) {
372
						$status = "phpDynDNS: (Success) IP Updated Successfully!";					
373
					} else {
374
						$status = "phpDynDNS: (Unknown Response)";
375
						$this->_debug($data);
376
					}
377
					break;
378
				case 'hn':
379
					break;
380
				case 'zoneedit':
381
					if (preg_match('/{700,799}/i', $data)) {
382
						$status = "phpDynDNS: (Error) Update Failed!";
383
					} else if (preg_match('/{200,201}/i', $data)) {
384
						$status = "phpDynDNS: (Success) IP Address Updated Successfully!";
385
					} else {
386
						$status = "phpDynDNS: (Unknown Response)";
387
						$this->_debug($data);
388
					}
389
					break;
390
				case 'dyns':
391
					if (preg_match("/400/i", $data)) {
392
						$status = "phpDynDNS: (Error) Bad Request - The URL was malformed. Required parameters were not provided.";
393
					} else if (preg_match('/402/i', $data)) {
394
						$status = "phpDynDNS: (Error) Update Too Soon - You have tried updating to quickly since last change.";
395
					} else if (preg_match('/403/i', $data)) {
396
						$status = "phpDynDNS: (Error) Database Error - There was a server-sided database error.";
397
					} else if (preg_match('/405/i', $data)) {
398
						$status = "phpDynDNS: (Error) Hostname Error - The hostname (".$this->_dnsHost.") doesn't belong to you.";
399
					} else if (preg_match('/200/i', $data)) {
400
						$status = "phpDynDNS: (Success) IP Address Updated Successfully!";
401
					} else {
402
						$status = "phpDynDNS: (Unknown Response)";
403
						$this->_debug($data);
404
					}
405
					break;
406
				case 'ods':
407
					if (preg_match("/299/i", $data)) {
408
						$status = "phpDynDNS: (Success) IP Address Updated Successfully!";
409
					} else {
410
						$status = "phpDynDNS: (Unknown Response)";
411
						$this->_debug($data);
412
					}
413
					break;
414
			}
415
			$this->status = $status;
416
			log_error($status);
417
		}
418

    
419
		/*
420
		 * Private Function (added 12 July 05) [beta]
421
		 *   Return Error, Set Last Error, and Die.
422
		 */
423
		function _error($errorNumber = '1') {
424
			switch ($errorNumber) {
425
				case 0:
426
					break;
427
				case 2:
428
					$error = 'phpDynDNS: (ERROR!) No Dynamic DNS Service provider was selected.';
429
					break;
430
				case 3:
431
					$error = 'phpDynDNS: (ERROR!) No Username Provided.';
432
					break;
433
				case 4:
434
					$error = 'phpDynDNS: (ERROR!) No Password Provided.';
435
					break;
436
				case 5:
437
					$error = 'phpDynDNS: (ERROR!) No Hostname Provided.';
438
					break;
439
				case 6:
440
					$error = 'phpDynDNS: (ERROR!) The Dynamic DNS Service provided is not yet supported.';
441
					break;
442
				case 10:
443
					$error = 'phpDynDNS: No Change In My IP Address and/or 28 Days Has Not Past. Not Updating Dynamic DNS Entry.';
444
					break;
445
				default:
446
					$error = "phpDynDNS: (ERROR!) Unknown Response.";
447
					$this->_debug($data);
448
					break;
449
			}
450
			$this->lastError = $error;
451
			log_error($error);
452
		}
453

    
454
		/*
455
		 * Private Function (added 12 July 05) [beta]
456
		 *   - Detect whether or not IP needs to be updated.
457
		 *      | Written Specifically for pfSense (pfsense.com) may
458
		 *      | work with other systems. pfSense base is FreeBSD.
459
		 */
460
		function _detectChange() {
461
			
462
			log_error("DynDns: _detectChange() starting.");
463
		
464
			$currentTime = time();
465

    
466
			$wan_ip = get_current_wan_address();
467
			$this->_dnsIP = $wan_ip;
468
			log_error("DynDns: Current WAN IP: {$wan_ip}");
469

    
470
			if (file_exists($this->_cacheFile)) {
471
				if(file_exists($this->_cacheFile))
472
					$contents = file_get_contents($this->_cacheFile);
473
				else
474
					$contents = "";
475
				list($cacheIP,$cacheTime) = split(':', $contents);
476
				$this->_debug($cacheIP.'/'.$cacheTime);
477
				$initial = false;
478
				log_error("DynDns: Cached IP: {cacheIP}");
479
			} else {
480
				conf_mount_rw();
481
				$file = fopen($this->_cacheFile, 'w');
482
				fwrite($file, '0.0.0.0:'.$currentTime);
483
				fclose($file);
484
				conf_mount_ro();
485
				$cacheIP = '0.0.0.0';
486
				$cacheTime = $currentTime;
487
				$initial = true;
488
				log_error("DynDns: No Cached IP found.");
489
			}
490

    
491
			/*   use 2419200 for dyndns, dhs, easydns, noip, hn
492
			 *   zoneedit, dyns, ods
493
			 */
494
			$time = '2419200';
495

    
496
			$needs_updating = FALSE;
497
			/* lets deterimine if the item needs updating */
498
			if ($cacheIP != $wan_ip) {
499
				$needs_updating = TRUE;
500
				log_error("DynDns: cacheIP != wan_ip.  Updating.");
501
			}
502
			$update_reason = "Cached IP: {$cacheIP} WAN IP: {$wan_ip} ";
503
			if (($currentTime - $cacheTime) > $time ) {
504
				$needs_updating = TRUE;
505
				log_error("DynDns: More than 28 days.  Updating.");
506
			}
507
			$update_reason .= "{$currentTime} - {$cacheTime} > {$time} ";
508
			if ($initial == TRUE) {
509
				$needs_updating = TRUE;
510
				$update_reason .= "Inital update. ";
511
				log_error("DynDns: Initial run.   Updating.");
512
			}
513
			/*   finally if we need updating then store the
514
			 *   new cache value and return true
515
                         */
516
			if($needs_updating == TRUE) {
517
				/* Write WAN IP to cache file */
518
				conf_mount_rw();
519
				$file = fopen($this->_cacheFile, 'w');
520
				fwrite($file, $wan_ip.':'.$currentTime);
521
				fclose($file);
522
				conf_mount_ro();
523
				return TRUE;
524
			} else {
525
				return FALSE;			
526
			}
527
			
528
			log_error("DynDns debug information: {$update_reason}");
529
			
530
		}
531

    
532
		/*
533
		 * Private Funcation (added 16 July 05) [beta]
534
		 *   - Writes debug information to a file.
535
		 *   - This function is only called when a unknown response
536
		 *   - status is returned from a DynDNS service provider.
537
		 */
538
		function _debug ($data) {
539
			$string = date('m-d-y h:i:s').' - ('.$this->_debugID.') - ['.$this->_dnsService.'] - '.$data;
540
			conf_mount_rw();
541
			$file = fopen($this->_debugFile, 'a');
542
			fwrite($file, $string);
543
			fclose($file);
544
			conf_mount_ro();
545
		}
546

    
547
	}
548

    
549
?>
(5-5/25)