Example #1
0
$debug = $argv[4] != "" ? 0 : 1;
require_once 'classes/Session.inc';
require_once 'classes/Databases.inc';
require_once "ossim_db.inc";
$db = new ossim_db();
$conn = $db->connect();
if ($debug) {
    echo "Retrieving Assets from entity/user: {$filter_by}...";
}
$allowedNets = "";
$allowedSensors = "";
if ($filter_by != "") {
    // Entity
    if (preg_match("/^\\d+\$/", $filter_by)) {
        $allowedSensors = Session::entityPerm($conn, $filter_by, "sensors");
        $allowedNets = Session::entityPerm($conn, $filter_by, "assets");
        // Username
    } elseif (preg_match("/^[A-Za-z0-9\\_\\-\\.]+\$/", $filter_by)) {
        $allowedSensors = Session::allowedSensors($filter_by);
        $allowedNets = Session::allowedNets($filter_by);
    }
}
if ($allowedNets == "" && $allowedSensors == "") {
    if ($debug) {
        echo "no filters for {$filter_by}\n";
    }
} else {
    // 1) GET ALLOWED HOSTS
    $sensor_where = "";
    if ($allowedSensors != "") {
        $user_sensors = explode(",", $allowedSensors);