Remove duplicate function declarations

and move functions to `func.php`.

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
This commit is contained in:
RD WebDesign
2022-05-11 18:14:37 -03:00
parent f8972ff19d
commit e2e3b07a0e
4 changed files with 35 additions and 62 deletions

View File

@@ -8,6 +8,8 @@
* Please see LICENSE file for your rights under this license. */
require_once('auth.php');
require_once('func.php');
require_once('database.php');
// Authentication checks
if (!isset($api)) {
@@ -21,27 +23,9 @@ if (!isset($api)) {
$reload = false;
require_once('func.php');
require_once('database.php');
$QueriesDB = getQueriesDBFilename();
$db = SQLite3_connect($QueriesDB, SQLITE3_OPEN_READWRITE);
function JSON_success($message = null)
{
header('Content-type: application/json');
echo json_encode(array('success' => true, 'message' => $message));
}
function JSON_error($message = null)
{
header('Content-type: application/json');
$response = array('success' => false, 'message' => $message);
if (isset($_POST['action'])) {
array_push($response, array('action' => $_POST['action']));
}
echo json_encode($response);
}
if ($_POST['action'] == 'delete_network_entry' && isset($_POST['id'])) {
// Delete netwwork and network_addresses table entry identified by ID
try {