-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
30 lines (22 loc) · 1.03 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/** Define APPLICATION constact to be able to load required files. */
define('APPLICATION', TRUE);
/** Require dependencies */
require_once 'Config.class.php';
require_once 'DDNSProvider.class.php';
/** Read request parameters */
$domain = $_GET['domain'] ?? die('ERROR: Missing required parameter: domain');
$host = $_GET['host'] ?? die('ERROR: Missing required parameter: host');
$user = $_GET['user'] ?? die('ERROR: Missing required parameter: user');
$token = $_GET['token'] ?? die('ERROR: Missing required parameter: token');
$ip = $_GET['ip'] ?? die('ERROR: Missing required parameter: ip');
/** Read configuration */
$config = new Config('config.inc.php');
/** Initialize new DDNS Provider */
$ddns = new DDNSProvider($config);
/** Tell the DNS provider the zone to use and then update the IP address */
if ($ddns->use($user, $token, $domain) === false) {
die('ERROR: Authentication failed. This might be due to invalid credentials or you\'re not allowed to update the specified domain.');
}
$ddns->updateIp($host, $ip);
die('OK');