<?php

include "admin/config/config.php";
include "admin/include/function.php";
$time = date("Y-m-d H:i:s");
if (isset($_GET["cancel"])) {
    cancel_request($_GET["cancel"]);
}
if (isset($_GET["reject"])) {
    reject_request($_GET["reject"]);
}
if (isset($_GET["unfriend"])) {
    unfriend_request($_GET["unfriend"]);
}
Example #2
0
function auth_request($op, $submit, $rids)
{
    global $dbconn;
    echo "<h2>Pending Scan Requests</h2>";
    //echo "<pre>$op = "; print_r($rids); echo "</pre>";
    if ($op != "" and !empty($rids)) {
        switch ($op) {
            case "process":
                process_requests($submit, $rids);
                break;
            case "accept":
                accept_request($rid);
                break;
            case "reject":
                reject_request($rid);
                break;
            default:
                break;
        }
        echo "<br>";
    }
    $query = "SELECT id, username, meth_VSET, meth_TARGET, scan_SUBMIT,\n                    date_format(scan_NEXT,'%m/%d/%Y %T')\n             FROM vuln_jobs \n\t     WHERE job_TYPE= 'R' AND authorized='0'\n             ORDER BY scan_NEXT";
    $result = $dbconn->execute($query);
    echo <<<EOT
<form method="post" action="sched.php">
<input type=hidden name="op" value="process">
<input type=hidden name="disp" value="auth_request">
     <table summary="Request Details" width=100%>
          <tr>
          <th>Requested Scan Date</th>
          <th>Request Submit Date</th>
          <th>Requester</th>
          <th>Host IP(s)</th>
\t  <th></th>
\t  </tr>
EOT;
    while (!$result->EOF) {
        list($rid, $rname, $rsid, $rhostip, $submit, $scantime) = $result->fields;
        $rhostip = trim($rhostip);
        // get rid of any extra whitespace at the end
        echo "<tr>";
        echo "<td>{$scantime}</td>";
        echo "<td>{$submit}</td>";
        //$requestor = getUserName($rname);
        //echo "<td>$rname";
        //if($requestor{'fname'} != "") { echo " - " . $requestor{'fname'};}
        //if($requestor{'lname'} != "") { echo " " .  $requestor{'lname'}; }
        //echo "</td>";
        //echo "<td>" . getProfileName( $rsid ) . "</td>";
        $ips = explode("\n", $rhostip);
        //echo "<pre>";
        //print_r($ips);
        //echo "</pre>";
        $hosttext = array();
        foreach ($ips as $ip) {
            $hosttext[] = gethostbyaddr("{$ip}") . " ({$ip})";
        }
        echo "<td>" . implode("<br>", $hosttext) . "</td>";
        echo "<td><input type=checkbox name='process[]' value='{$rid}'></td>";
        $result->MoveNext();
    }
    echo "</table>";
    echo "<input type=submit name=submit value='Reject Requests'>";
    echo "&nbsp;&nbsp;&nbsp;<input type=submit name=submit value='Approve Requests'>";
    echo "</form>";
}