Example #1
0
// found as array search will return false
$row = $result->FetchRow();
if (!in_array($row["admingrp"], $grps)) {
    myError($w, $p, my_("You may not send a registrar update for this customer as you are not a member of the customers admin group"));
}
$formerror = "";
$cnt = 0;
foreach ($baseindex as $key => $value) {
    $value = floor($value);
    // dont trust values posted
    $result = $ds->GetBaseFromIndex($value);
    $row = $result->FetchRow();
    $baseip = inet_ntoa($row["baseaddr"]);
    $size = $row["subnetsize"];
    $swipmod = $row["swipmod"];
    $swip = genSWIP($ds, $value, $baseip, inet_ntoa($row["baseaddr"] + $size - 1), $cust, $row["descrip"], $swipmod, $filename);
    insert($w, block("<pre>"));
    insert($w, text($swip));
    insert($w, block("</pre><hr>"));
    $err = emailSWIP($swip);
    // on email error, fail
    if ($err) {
        $formerror .= my_("E-mail message was not sent") . "\n";
        $formerror .= my_("Mailer Error: ") . $err;
        break;
    }
    $result =& $ds->ds->Execute("UPDATE base\n                          SET swipmod=" . $ds->ds->DBTimeStamp(time()) . "\n                          WHERE baseindex={$value}");
    $ds->AuditLog(array("event" => 190, "action" => "send swip", "user" => getAuthUsername(), "baseaddr" => $baseip, "template" => $filename, "size" => $size, "cust" => $cust));
}
myError($w, $p, $formerror, FALSE);
insert($w, block("<p>"));
Example #2
0
    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) {
        myError($w, $p, my_("Error reading template!"));
    }
    insert($f, block("<pre>"));
    insert($f, text($swip));
    insert($f, block("</pre>"));
    $ind = $row["baseindex"];
    insert($f, checkbox(array("name" => "baseindex[]", "value" => "{$ind}"), my_("E-mail this entry?")));
    if ($row["swipmod"]) {
        insert($f, text(" " . my_("Previously sent:") . " "));
        insert($f, block($result->UserTimeStamp($row["swipmod"], "M d Y H:i:s")));
    }
    insert($f, block("<hr>"));
    $cnt++;
}