Location: PHPKode > projects > Network Asset Management Archive > nama/iaso/pickedit.php
<?
//phpinfo();
$lastweek = date("m/j/y h:i:s",time()-(60*60*24*7));
$LABlist = $_POST['LABlist'];
$SUBNET = $_POST['SUBNET'];
$OSlist = $_POST['OSlist'];
$IASOlist = $_POST['IASO'];
$SAlist = $_POST['SA'];
$Submit3 = $_POST['Submit3'];
$Submit4 = $_POST['Submit4'];
$Submit5 = $_POST['Submit5'];
$Submit6 = $_POST['Submit6'];
$Submit7 = $_POST['Submit7'];
$Submit8 = $_POST['Submit8'];
$Submit9 = $_POST['Submit9'];
$Submit10 = $_POST['Submit10'];
$Submit11 = $_POST['Submit11'];
if ($Submit7!=''){
   $stmt = "FROM arp_table a, subnets b, viruslog v where (a.subnet=b.subnet) and (a.ip_address<>'0.0.0.0')  ";
} 

if ($Submit8!='') {
   $stmt = "FROM arp_table a, subnets b, viruslog v where (a.subnet=b.subnet) and (a.ip_address<>'0.0.0.0') ";
}  
if ($Submit11=='CRD2') {
     $stmt = "FROM arp_table a, subnets b where (a.subnet = b.subnet) and (a.ip_address<>'0.0.0.0') and (a.netbios_name<>'' ) ";
}

if (($Submit7=='') && ($Submmit8=='')) {
   $stmt = "FROM arp_table a, subnets b where (a.subnet = b.subnet) and (a.ip_address<>'0.0.0.0') ";
}
if (sizeof($SAlist) != 0) {
    if (sizeof($SAlist) == 1){
        $stmt = $stmt . " and ((OWNER = '$SAlist[0]') or (SYSTEM_USER = '$SAlist[0]'))";
    }
    else
    {
       $stmt = $stmt . " and ((OWNER in (";
       for ($i=0; $i < sizeof($SAlist); $i++) {
            $stmt = $stmt . $SAlist[$i];
            if ($i < sizeof($SAlist)-1) {
                 $stmt = $stmt . ",";
            }
            else {
                  $stmt = $stmt . "))";
            }
       }
       $stmt = $stmt . " or (SYSTEM_USER in (";
       for ($i=0; $i < sizeof($SAlist); $i++) {
            $stmt = $stmt . $SAlist[$i];
            if ($i < sizeof($SAlist)-1) {
                 $stmt = $stmt . ",";
            }
            else {
                  $stmt = $stmt . ")))";
            }
     }

   }
}
else
{

if (sizeof($IASOlist) != 0) {
    if (sizeof($IASOlist) == 1){
        $stmt = $stmt . " and (IASO = '$IASOlist[0]')";
    }
    else 
    {
       $stmt = $stmt . " and (IASO in (";
       for ($i=0; $i < sizeof($IASOlist); $i++) {
            $stmt = $stmt . $IASOlist[$i];
            if ($i < sizeof($IASOlist)-1) {
                 $stmt = $stmt . ",";
            }
            else {
                  $stmt = $stmt . ")";
            }
     }
   }
}
else 
{

if (sizeof($LABlist) != 0) {
        $hadlab = true;
        if (sizeof($LABlist) == 1) {
        $stmt = $stmt . " and ((LAB = '$LABlist[0]')";
        }
        else {
                $stmt = $stmt . " and ((LAB in (";
                for ($i=0; $i < sizeof($LABlist); $i++) {
                    $stmt = $stmt . $LABlist[$i];
                    if ($i < sizeof($LABlist)-1) {
                        $stmt = $stmt . ",";
                    }
                    else {
                        $stmt = $stmt . "))";
                    }
                }
        }
}
if (sizeof($SUBNET) != 0) {
        $hadlab = true;
        if (sizeof($SUBNET) == 1) {
                if (sizeof($LABlist) == 0) {
                     $stmt = $stmt . " and (a.SUBNET = '$SUBNET[0]')";
                }
                else {
                     $stmt = $stmt . " or (a.SUBNET = '$SUBNET[0]')";
                }
        }
        else {
                if (sizeof($LABlist) == 0) {
                        $stmt = $stmt . " and (a.SUBNET in ('";
                }
                else {
                        $stmt = $stmt . " or (a.SUBNET in ('";
                }
                for ($i=0; $i < sizeof($SUBNET); $i++) {
                    $stmt = $stmt . $SUBNET[$i];
                    if ($i < sizeof($SUBNET)-1) {
                        $stmt = $stmt . "','";
                    }
                    else {
                        $stmt = $stmt . "'))";
                    }
                }
        }
}
if (sizeof($LABlist) != 0) {
        $stmt = $stmt . ")";
}
if (sizeof($OSlist) != 0) {
        $hadlab = true;
        if (sizeof($OSlist) == 1) {
        $stmt = $stmt . " and (OS = '$OSlist[0]')";
        }
        else {
                $stmt = $stmt . " and (OS in ('";
                for ($i=0; $i < sizeof($OSlist); $i++) {
                    $stmt = $stmt . $OSlist[$i];
                    if ($i < sizeof($OSlist)-1) {
                        $stmt = $stmt . "','";
                    }
                    else {
                        $stmt = $stmt . "'))";
                    }
                }
        }
}
}
}
if ($Submit3=='No Green') {
$stmt = $stmt .  'and ((owner is null) or (iaso is null) or (building is null) or (room is null) or (barcode is null) or (owner is null) or (os is null))';
}
if ($Submit4=='On Update Server') {
$stmt = $stmt .  'and (UPDATE_SERVER is not null)';
}
if ($Submit5=='Not On Update Server') {
$stmt = $stmt .  "and (UPDATE_SERVER is null) and ((OS starts with 'Windows') or (OS is null))";
}
if ($Submit6!='') {
$stmt = $stmt .  "and (AV_SERVER is null) and ((OS starts with 'Windows') or (OS is null))";
}
if ($Submit7!='') {
$stmt = $stmt .  "and (a.serial = v.arp_table) and (((v.alert_type='VF') and (v.checked is null) and (v.eventdate>'$lastweek')))";
}
if ($Submit8!='') {
$stmt = $stmt .  "and (a.virus_found=1)";
}
if ($Submit9!='') {
$stmt = $stmt .  "and (a.cac_type is not null)";
}
if ($Submit10!='') {
$stmt = $stmt .  "and (a.cac_type is null) and (os starts with 'Win')";
}
//echo $stmt;
//$stmt = urlencode($stmt);

//echo $stmt;
 if ($Submit11=='CRD2') {
include "../datediff.inc";
$now = date("m/j/y h:i:s",time());
include "../connect.php";

$stmt = "select a.*, b.units_served " . $stmt . " order by ipnum";
//echo $stmt;
$sth = ibase_query($dbh, $stmt);
while ($row = ibase_fetch_object($sth)) {

          $mymac = strtoupper($row->MAC_ADDRESS);
        $currenttime = time();
        $lasttime = strtotime($row->LAST_SEEN);
        $diffseen = - DateDiff ("d",$currenttime , $lasttime);
        $daysseen = floor($diffseen);
       if ($daysseen<10) {
             if ($row->NETBIOS_NAME != '') {
                  echo $row->NETBIOS_NAME . '_';
             } else if ($row->DNS_NAME != '') {
                  echo $row->DNS_NAME . '_';
               }
             if ($row->OS!='') {
                   $myos = str_replace("NetworkGear-","",str_replace(" ", "", $row->OS . '_'));
                   $myos = str_replace("Other-","",$myos);
                   $myos = str_replace("Windows-","WIN",$myos);
                   $myos = str_replace("Printers","Printer",$myos);
                   $myos = str_replace("Switches","Switch",$myos);
                   $myos = str_replace("Routers","Router",$myos);

                   echo $myos;
             } else {
                   echo 'Unknown_';
             }
          if ($row->BARCODE!='') {
                   $mybc = str_replace("na",$row->MAC_ADDRESS,$row->BARCODE);
                   $mybc = str_replace("NA",$row->MAC_ADDRESS,$mybc);
                   $mybc = str_replace("N/A",$row->MAC_ADDRESS,$mybc);
                   $mybc = str_replace("GSA",$row->MAC_ADDRESS,$mybc);
             echo $mybc; }
          else { echo $row->MAC_ADDRESS;}
         
          echo  "," . $row->IP_ADDRESS, ",";
          echo $mymac[0] . $mymac[1] . ':';
          echo $mymac[2] . $mymac[3] . ':';
          echo $mymac[4] . $mymac[5] . ':';
          echo $mymac[6] . $mymac[7] . ':';
          echo $mymac[8] . $mymac[9] . ':';
          echo $mymac[10] . $mymac[11];
//          echo '              ,' . $row->LAST_SEEN;
          echo "<BR>";
}
}
} else { include "getpicks3.php"; }
//<html>
//
//<title>IASO Review Page</title>
//<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
//</head>
//<frameset rows="*" cols="*" frameborder="NO" border="0" framespacing="0"> 
//  <frame name="leftFrame" noresize src="getpicks3.php?stmt=<? print $stmt " marginwidth="0" marginheight="0">
//</frameset>
//<noframes><body bgcolor="#FFFFFF" text="#000000">
//
//</body></noframes>
//</html>

?>

Return current item: Network Asset Management Archive