Esempio n. 1
0
<?php

include_once '../../config/config.php';
include_once $serverPath . 'utils/db/db_get.php';
$table = "dungeon";
$traps_table = "traps";
if (!empty($_GET['id'])) {
    echo json_encode(findById($table, $_GET['id']));
} else {
    if (!empty($_GET['column'])) {
        $column = $_GET['column'];
        if ($column == "index") {
            $columns = ['name', 'purpose', 'location', 'creator'];
            print json_encode(getSpecificData($table, $columns));
        } else {
            if ($column == "traps") {
                print json_encode(getAllData($traps_table));
            }
        }
    }
}
Esempio n. 2
0
<?php

include_once '../config/config.php';
include_once $serverPath . 'utils/security/requireAdmin.php';
include_once $serverPath . 'utils/db/db_get.php';
if (!empty($_GET['get'])) {
    $get = $_GET['get'];
    if ($get == "users") {
        $table = "users";
        $columns = ['username', 'email', 'admin', 'protected', 'assestDefaultAccess'];
        $data = getSpecificData($table, $columns);
        $returnData = [];
        foreach ($data as $row) {
            if ($row['protected'] == 0) {
                array_push($returnData, $row);
            }
        }
        echo json_encode($returnData);
    }
}