Example #1
0
             if (!in_array($custrow["admingrp"], $grps)) {
                 continue;
             }
         }
     }
     $menustring = $menustring . ".|" . htmlspecialchars($custrow["custdescrip"]) . "|displaybase.php?cust=" . $custrow["customer"] . "||||{$expanded}\n";
     $menustring = $menustring . "..|" . my_("All subnets not part of range") . "|displaybase.php?cust=" . $custrow["customer"] . "&areaindex=-1||||\n";
     $arearesult = $ds->GetArea($custrow["customer"], 0);
     //area
     while ($arearow = $arearesult->Fetchrow()) {
         $menustring = $menustring . "..|" . htmlspecialchars(inet_ntoa($arearow["areaaddr"]) . " (" . $arearow["descrip"] . ")") . "|displaybase.php?cust=" . $custrow["customer"] . "&areaindex=" . $arearow["areaindex"] . "||||\n";
         $rangeresult = $ds->GetRangeInArea($custrow["customer"], $arearow["areaindex"]);
         //range
         while ($rangerow = $rangeresult->Fetchrow()) {
             $menustring = $menustring . "...|" . htmlspecialchars(inet_ntoa($rangerow["rangeaddr"]) . " (" . $rangerow["descrip"] . ")") . "|displaybase.php?cust=" . $custrow["customer"] . "&areaindex=" . $arearow["areaindex"] . "&rangeindex=" . $rangerow["rangeindex"] . "&descrip=&sortby=Base+Address" . "||||\n";
             $baseresult = $ds->GetBase($rangerow["rangeaddr"], $rangerow["rangeaddr"] + $rangerow["rangesize"] - 1, "", $custrow["customer"]);
             //subnet (base)
             while ($baserow = $baseresult->Fetchrow()) {
                 $menustring = $menustring . "....|" . htmlspecialchars(inet_ntoa($baserow["baseaddr"]) . " /" . inet_bits($baserow["subnetsize"]) . " (" . $baserow["descrip"] . ")") . "|displaysubnet.php?baseindex=" . $baserow["baseindex"] . "||||\n";
             }
         }
     }
 }
 $mid = new TreeMenu();
 $mid->setDirroot('../menus');
 $mid->setLibjsdir('../menus/libjs/');
 $mid->setImgdir('../menus/menuimages/');
 $mid->setImgwww('../menus/menuimages/');
 $mid->setIcondir('../menus/menuicons/');
 $mid->setIconwww('../menus/menuicons/');
 if (!$menustring) {
Example #2
0
// basic sequence is connect, search, interpret search
// result, close connection
// explicitly cast variables as security measure against SQL injection
list($cust) = myRegister("I:cust");
$ds = new IPplanDbf() or die(my_("Could not connect to database"));
// force file download due to bad mime type
header("Content-Type: bad/type");
header("Content-Disposition: attachment; filename=base.txt");
header("Pragma: no-cache");
header("Expires: 0");
$startnum = inet_aton(DEFAULTROUTE);
$endnum = inet_aton(ALLNETS);
// if a specific network template exists, use that, else use generic template
$template = new IPplanIPTemplate("basetemplate", $cust);
$err = $template->is_error();
$result = $ds->GetBase($startnum, $endnum, '', $cust);
while ($row = $result->FetchRow()) {
    echo inet_ntoa($row["baseaddr"]) . FIELDS_TERMINATED_BY . $row["descrip"] . FIELDS_TERMINATED_BY . inet_ntoa(inet_aton(ALLNETS) + 1 - $row["subnetsize"]) . FIELDS_TERMINATED_BY;
    if (!$err) {
        $result_template =& $ds->ds->Execute("SELECT info, infobin\n                FROM baseadd\n                WHERE baseindex=" . $row["baseindex"]);
        if ($rowadd = $result_template->FetchRow()) {
            $template->Merge($template->decode($rowadd["info"]));
            foreach ($template->userfld as $arr) {
                $tmpfield = csv_escape($arr["value"]);
                echo FIELDS_TERMINATED_BY . $arr["value"];
            }
        }
    }
    echo "\n";
}
// wrap any multiline string with quotes
Example #3
0
            myError($w, $p, my_("Invalid IP address!"));
        }
    } else {
        $start = DEFAULTROUTE;
        $end = ALLNETS;
    }
}
$startnum = inet_aton($start);
$endnum = inet_aton($end);
$custdescrip = $ds->GetCustomerDescrip($cust);
if ($areaindex and !$rangeindex) {
    insert($w, heading(3, sprintf(my_("Search for IP subnets between multiple ranges for customer '%s'"), $custdescrip)));
    $result = $ds->GetBaseFromArea($areaindex, $descrip, $cust);
} else {
    insert($w, heading(3, sprintf(my_("Search for IP subnets between %s and %s %s for customer '%s'"), $start, $end, $site, $custdescrip)));
    $result = $ds->GetBase($startnum, $endnum, $descrip, $cust);
}
if ($ipaddr) {
    insert($w, textb(my_("IP address filter: ")));
    insert($w, textbr($ipaddr));
}
if ($descrip) {
    insert($w, textb(my_("Description filter: ")));
    insert($w, textbr($descrip));
}
insert($w, $f = form(array("name" => "swiptosend", "method" => "post", "action" => "emailswip.php")));
$cnt = 0;
while ($row = $result->FetchRow()) {
    $temparray2 = array();
    $swip = genSWIP($ds, $row["baseindex"], inet_ntoa($row["baseaddr"]), inet_ntoa($row["baseaddr"] + $row["subnetsize"] - 1), $cust, $row["descrip"], $row["swipmod"], $filename);
    if ($swip == FALSE) {