Hi All,
I have a piHole setup in a remote environment, when trying to access the Admin GUI I get the below error
|| $type === ListType::blacklist) { // If adding to the exact lists, we convert the domain lower case and check whether it is valid $domain = strtolower($domain); if(filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) === false) { // This is the case when idn_to_ascii() modified the string if($input !== $domain && strlen($domain) > 0) $errormsg = 'Domain ' . htmlentities($input) . ' (converted to "' . htmlentities(utf8_encode($domain)) . '") is not a valid domain.'; elseif($input !== $domain) $errormsg = 'Domain ' . htmlentities($input) . ' is not a valid domain.'; else $errormsg = 'Domain ' . htmlentities(utf8_encode($domain)) . ' is not a valid domain.'; throw new Exception($errormsg . '
Added ' . $added . " out of ". $total . " domains"); } } // First try to delete any occurrences of this domain if we're in // replace mode. Only do this when the domain to be replaced is in // the default group! Otherwise, we would shuffle group settings and // just throw an error at the user to tell them to change this // domain manually. This ensures user's will really get what they // want from us. if($_POST['action'] == 'replace_domain') { if (!$check_stmt->bindValue(':domain', $domain, SQLITE3_TEXT)) { throw new Exception('While binding domain to check: ' . $db->lastErrorMsg() . '
'. 'Added ' . $added . " out of ". $total . " domains"); } $check_result = $check_stmt->execute(); if (!$check_result) { throw new Exception('While executing check: ' . $db->lastErrorMsg() . '
'. 'Added ' . $added . " out of ". $total . " domains"); } // Check return value of CHECK query (0 = only default group, 1 = special group assignments) $only_default_group = (($check_result->fetchArray(SQLITE3_NUM)[0]) == 0) ? true : false; if(!$only_default_group) { throw new Exception('Domain ' . $domain . ' is configured with special group settings.
'. 'Please modify the domain on the respective group management pages.'); } if (!$delete_stmt->bindValue(':domain', $domain, SQLITE3_TEXT)) { throw new Exception('While binding domain: ' . $db->lastErrorMsg() . '
'. 'Added ' . $added . " out of ". $total . " domains"); } if (!$delete_stmt->execute()) { throw new Exception('While executing: ' . $db->lastErrorMsg() . '
'. 'Added ' . $added . " out of ". $total . " domains"); } } if (!$insert_stmt->bindValue(':domain', $domain, SQLITE3_TEXT) || !$update_stmt->bindValue(':domain', $domain, SQLITE3_TEXT)) { throw new Exception('While binding domain: ' . $db->lastErrorMsg() . '
'. 'Added ' . $added . " out of ". $total . " domains"); } // First execute INSERT OR IGNORE statement to create a record for // this domain (ignore if already existing) if (!$insert_stmt->execute()) { throw new Exception('While executing INSERT OT IGNORE: ' . $db->lastErrorMsg() . '
'. 'Added ' . $added . " out of ". $total . " domains"); } // Then update the record with a new comment (and modification date // due to the trigger event) We are not using REPLACE INTO to avoid // the initial DELETE event (loosing group assignments in case an // entry did already exist). if (!$update_stmt->execute()) { throw new Exception('While executing UPDATE: ' . $db->lastErrorMsg() . '
'. 'Added ' . $added . " out of ". $total . " domains"); } $added++; } if(!$db->query('COMMIT;')) { throw new Exception('While commiting changes to the database: ' . $db->lastErrorMsg()); } $after = intval($db->querySingle("SELECT COUNT(*) FROM domainlist;")); $difference = $after - $before; if($total === 1) { if($difference !== 1) { $msg = "Not adding ". htmlentities(utf8_encode($domain)) . " as it is already on the list"; } else { $msg = "Added " . htmlentities(utf8_encode($domain)); } } else { if($difference !== $total) { $msg = "Added " . ($after-$before) . " out of ". $total . " domains (skipped duplicates)"; } else { $msg = "Added " . $total . " domains"; } } $reload = true; JSON_success($msg); } catch (\Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'edit_domain') { // Edit domain identified by ID try { $db->query('BEGIN TRANSACTION;'); $stmt = $db->prepare('UPDATE domainlist SET enabled=:enabled, comment=:comment, type=:type WHERE id = :id'); if (!$stmt) { throw new Exception('While preparing statement: ' . $db->lastErrorMsg()); } $status = intval($_POST['status']); if ($status !== 0) { $status = 1; } if (!$stmt->bindValue(':enabled', $status, SQLITE3_INTEGER)) { throw new Exception('While binding enabled: ' . $db->lastErrorMsg()); } $comment = html_entity_decode($_POST['comment']); if (strlen($comment) === 0) { // Store NULL in database for empty comments $comment = null; } if (!$stmt->bindValue(':comment', $comment, SQLITE3_TEXT)) { throw new Exception('While binding comment: ' . $db->lastErrorMsg()); } if (!$stmt->bindValue(':type', intval($_POST['type']), SQLITE3_INTEGER)) { throw new Exception('While binding type: ' . $db->lastErrorMsg()); } if (!$stmt->bindValue(':id', intval($_POST['id']), SQLITE3_INTEGER)) { throw new Exception('While binding id: ' . $db->lastErrorMsg()); } if (!$stmt->execute()) { throw new Exception('While executing: ' . $db->lastErrorMsg()); } $stmt = $db->prepare('DELETE FROM domainlist_by_group WHERE domainlist_id = :id'); if (!$stmt) { throw new Exception('While preparing DELETE statement: ' . $db->lastErrorMsg()); } if (!$stmt->bindValue(':id', intval($_POST['id']), SQLITE3_INTEGER)) { throw new Exception('While binding id: ' . $db->lastErrorMsg()); } if (!$stmt->execute()) { throw new Exception('While executing DELETE statement: ' . $db->lastErrorMsg()); } $groups = array(); if(isset($_POST['groups'])) $groups = $_POST['groups']; foreach ($groups as $gid) { $stmt = $db->prepare('INSERT INTO domainlist_by_group (domainlist_id,group_id) VALUES(:id,:gid);'); if (!$stmt) { throw new Exception('While preparing INSERT INTO statement: ' . $db->lastErrorMsg()); } if (!$stmt->bindValue(':id', intval($_POST['id']), SQLITE3_INTEGER)) { throw new Exception('While binding id: ' . $db->lastErrorMsg()); } if (!$stmt->bindValue(':gid', intval($gid), SQLITE3_INTEGER)) { throw new Exception('While binding gid: ' . $db->lastErrorMsg()); } if (!$stmt->execute()) { throw new Exception('While executing INSERT INTO statement: ' . $db->lastErrorMsg()); } } if(!$db->query('COMMIT;')) { throw new Exception('While commiting changes to the database: ' . $db->lastErrorMsg()); } $reload = true; JSON_success(); } catch (\Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'delete_domain') { // Delete domain identified by ID try { $db->query('BEGIN TRANSACTION;'); $stmt = $db->prepare('DELETE FROM domainlist_by_group WHERE domainlist_id=:id'); if (!$stmt) { throw new Exception('While preparing domainlist_by_group statement: ' . $db->lastErrorMsg()); } if (!$stmt->bindValue(':id', intval($_POST['id']), SQLITE3_INTEGER)) { throw new Exception('While binding id to domainlist_by_group statement: ' . $db->lastErrorMsg()); } if (!$stmt->execute()) { throw new Exception('While executing domainlist_by_group statement: ' . $db->lastErrorMsg()); } $stmt = $db->prepare('DELETE FROM domainlist WHERE id=:id'); if (!$stmt) { throw new Exception('While preparing dom
Can someone tell what this error relates to? The remote sites does not have any PC's running, just a couple of sensors. Can SSH into the device using onsite Gateway's terminal.
pihole is running on Raspberry Pi3 on debian buster.