Files
web/scripts/pi-hole/php/customcname.php
Matthias rank 212da94228 Added token verification
Moved CNAME functions to func.php
Added teleporter support
Fixed CNAME and DNS file declaration (filename was declarated in seperate file, therefore trying to read those files from func.php failed)
Fixed error and success response functions in func.php (calling addCustomDNSEntry and addCustomCNAMEEntry repeatedly from teleporter failed because of error function defined inside of those functions)

Signed-off-by: Matthias Rank <development@m-rank.de>
2020-05-21 14:48:13 +02:00

24 lines
646 B
PHP

<?php
require_once "func.php";
require_once('auth.php');
// Authentication checks
if (isset($_POST['token'])) {
check_cors();
check_csrf($_POST['token']);
} else {
log_and_die('Not allowed (login session invalid or expired, please relogin on the Pi-hole dashboard)!');
}
switch ($_REQUEST['action'])
{
case 'get': echo json_encode(echoCustomCNAMEEntries()); break;
case 'add': echo json_encode(addCustomCNAMEEntry()); break;
case 'delete': echo json_encode(deleteCustomCNAMEEntry()); break;
default:
die("Wrong action");
}
?>