Files
web/scripts/pi-hole/php/customdns.php
Adam Warner 7b2d396295 require auth for the customDNS page
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-05-20 08:26:21 +01:00

29 lines
689 B
PHP

<?php
require_once "func.php";
$customDNSFile = "/etc/pihole/custom.list";
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 ($_POST['action'])
{
case 'get': echo json_encode(echoCustomDNSEntries()); break;
case 'add': echo json_encode(addCustomDNSEntry()); break;
case 'delete': echo json_encode(deleteCustomDNSEntry()); break;
default:
die("Wrong action");
}
?>