top.window.location = '../../index.php'"; exit; } require_once __DIR__ . "/" . "../../includes/include_basics_only.php"; require_once __DIR__ . "/" . "../../includes/classes/ConnectPDO.php"; use includes\classes\ConnectPDO; $conn = ConnectPDO::getInstance(); $post = $_POST; $terms = ""; $cod = (isset($post['cod']) ? (int)$post['cod'] : ""); $action = (isset($post['action']) && !empty($post['action']) ? $post['action'] : ""); $areaAdmin = 0; if (isset($_SESSION['s_area_admin']) && $_SESSION['s_area_admin'] == '1' && $_SESSION['s_nivel'] != '1') { $areaAdmin = 1; } $setAdmin = (isset($post['setAdmin']) && $post['setAdmin'] == "true" ? 1 : 0); $primary_area = (isset($post['primary_area']) ? $post['primary_area'] : ""); if (empty($primary_area) ) { return false; } if (isset($post['level']) && (($post['level'] == 3) || ($post['level'] == 5))) { return false; } $terms .= (!empty($primary_area) ? " AND sis_id <> {$primary_area} " : ""); $sql = "SELECT sis_id, sistema FROM sistemas WHERE sis_atende = 1 AND sis_status = 1 {$terms}"; $sql .= "ORDER BY sistema"; try { $res = $conn->query($sql); } catch (Exception $e) { return false; } $uareas = []; ?>