Ejemplo n.º 1
0
$grps = $auth->authenticate();
// set language
isset($_COOKIE["ipplanLanguage"]) && myLanguage($_COOKIE['ipplanLanguage']);
//setdefault("window",array("bgcolor"=>"white"));
$title = my_("Delete customer/autonomous system results");
newhtml($p);
$w = myheading($p, $title, true);
// explicitly cast variables as security measure against SQL injection
list($cust) = myRegister("I:cust");
if (!$_GET) {
    myError($w, $p, my_("You cannot reload or bookmark this page!"));
}
// basic sequence is connect, search, interpret search
// result, close connection
$ds = new IPplanDbf() or myError($w, $p, my_("Could not connect to database"));
if (!$ds->TestCustomerCreate(getAuthUsername())) {
    myError($w, $p, my_("You may not delete customers as you are not a member a group that can delete customers"));
}
// check if customer has subnets assigned
$result =& $ds->ds->SelectLimit("SELECT baseaddr, descrip\n                           FROM base\n                           WHERE customer={$cust}\n                           ORDER BY baseaddr", 100);
if ($row = $result->FetchRow()) {
    insert($w, text(my_("Cannot delete customer because the following subnets are assigned to the customer (limited to first 100):")));
    insert($w, block("<p>"));
    // create a table
    insert($w, $t = table(array("cols" => "2", "class" => "outputtable")));
    // draw heading
    setdefault("cell", array("class" => "heading"));
    insert($t, $c = cell());
    insert($c, text(my_("Base address")));
    insert($t, $c = cell());
    insert($c, text(my_("Subnet description")));