permission($radice)) { if (isset($_GET["draw"])) { $return = array(); $return["draw"] = (int)$_GET["draw"]; $return["recordsTotal"] = (int)0; $return["recordsFiltered"] = (int)0; $bind = array(); $sql = "SELECT b_log.codice, b_log.nometab, b_log.operazione, b_log.id_record, b_log.ip, b_log.dataop, b_utenti.cognome, b_utenti.nome "; if (empty($_SESSION["ente"])) { $sql .= ",b_enti.denominazione "; } $sql.= "FROM b_log LEFT JOIN b_utenti ON b_log.codoperatore = b_utenti.codice "; if (empty($_SESSION["ente"])) { $sql .= "LEFT JOIN b_enti ON b_log.codice_ente = b_enti.codice "; } $where = ""; if (!empty($_SESSION["log-filter"])) { if (isset($_SESSION["log-filter"]["nometab"]) && $_SESSION["log-filter"]["nometab"] !== "") { $bind[":nometab"] = $_SESSION["log-filter"]["nometab"]; $where .= (empty($where)) ? "WHERE " : "AND "; $where .= "b_log.nometab = :nometab "; } if (!empty($_SESSION["log-filter"]["operazione"])) { $bind[":operazione"] = $_SESSION["log-filter"]["operazione"]; $where .= (empty($where)) ? "WHERE " : "AND "; $where .= "b_log.operazione = :operazione "; } if (!empty($_SESSION["log-filter"]["id_record"])) { $bind[":id_record"] = $_SESSION["log-filter"]["id_record"]; $where .= (empty($where)) ? "WHERE " : "AND "; $where .= "b_log.id_record = :id_record "; } if (!empty($_SESSION["log-filter"]["ip"])) { $sud = suddivisione_pdo($_SESSION["log-filter"]["ip"],"ip"); $bind = array_merge($bind,$sud["bind"]); $where .= (empty($where)) ? "WHERE " : "AND "; $where .= $sud["sql"]; } if (!empty($_SESSION["log-filter"]["user"])) { $where .= (empty($where)) ? "WHERE (" : "AND ("; $sud = suddivisione_pdo($_SESSION["log-filter"]["user"],"b_utenti.cognome"); $bind = array_merge($bind,$sud["bind"]); $where .= $sud["sql"] . "OR "; $sud = suddivisione_pdo($_SESSION["log-filter"]["user"],"b_utenti.nome"); $bind = array_merge($bind,$sud["bind"]); $where .= $sud["sql"] . ")"; } if (isset($_SESSION["log-filter"]["codice_ente"]) && $_SESSION["log-filter"]["codice_ente"] !== "") { $bind[":codice_ente"] = $_SESSION["log-filter"]["codice_ente"]; $where .= (empty($where)) ? "WHERE " : "AND "; $where .= "b_log.codice_ente = :codice_ente "; } if (!empty($_SESSION["log-filter"]["from"])) { $bind[":dataop_from"] = datetime2mysql($_SESSION["log-filter"]["from"]); $where .= (empty($where)) ? "WHERE " : "AND "; $where .= "b_log.dataop >= :dataop_from "; } if (!empty($_SESSION["log-filter"]["to"])) { $bind[":dataop_to"] = datetime2mysql($_SESSION["log-filter"]["to"]); $where .= (empty($where)) ? "WHERE " : "AND "; $where .= "b_log.dataop <= :dataop_to "; } } $sql .= $where; if (!empty($_SESSION["ente"])) { $bind[":codice_ente"] = $_SESSION["ente"]->codice; $sql .= (empty($where)) ? "WHERE " : "AND "; $sql .= " b_log.codice_ente = :codice_ente "; } $ris = $pdo->go($sql,$bind); if ($ris->rowCount() > 0) { $return["recordsTotal"] = (int)$ris->rowCount(); $sql .= "ORDER BY b_log.codice DESC "; if ($_GET["length"] !== "-1") { $sql.= "LIMIT ". (int)$_GET["start"] .", " . (int)$_GET["length"]; } $ris = $pdo->go($sql,$bind); if ($ris->rowCount() > 0) { $return["recordsFiltered"] = $return["recordsTotal"]; $return["data"] = array(); while($record = $ris->fetch(PDO::FETCH_ASSOC)) { $row = array(); $row[] = $record["codice"]; $row[] = $record["nometab"]; $row[] = $record["operazione"]; $row[] = $record["id_record"]; $row[] = $record["ip"]; $row[] = $record["cognome"] . " " . $record["nome"]; $row[] = (empty($record["denominazione"])) ? "" : $record["denominazione"]; $row[] = mysql2datetime($record["dataop"]); $row[] = ""; ob_start(); ?> #
Tab:
Ope:
Row:
IP:
User:
IP:
Time: