Location: PHPKode > projects > Network Asset Management Archive > nama/iaso/getpicks.php
<?php
include "../datediff.inc";
$now = date("m/j/y h:i:s",time());
include "../connect.php";
print '<HTML>';
print '	<HEAD>';
print '	  <TITLE>Your Hosts</TITLE>';
print '	</HEAD>';
print '<body bgcolor="#F9F3E0">';
$stmt = $_GET['stmt'];
$stmt = stripslashes($stmt);
$now = date("j/m/y h:i:s",time());
$stmt = "Select distinct a.* " . $stmt . " order by IPNUM";
//echo $stmt;
$sth = ibase_query($dbh, $stmt);
$i = 0;
?>
<body bgcolor="#F9F3E0" text="#000000">
<?

while ($row = ibase_fetch_object($sth)) {
$currenttime = time();
$lasttime = strtotime($row->LAST_SEEN);
$diffseen = - DateDiff ("d",$currenttime , $lasttime);
$daysseen = floor($diffseen);
    print '<table width="240" bgcolor="#F9F3E0" border="2">';
    print '<input type="hidden" name="serial[]" value="' . $row->SERIAL . '">';
    print '    <tr> ';
//    if (($row->BARCODE=='') || ($row->IASO=='') || ($row->OWNER=='') || ($row->OS=='') || ($row->BUILDING=='') || ($row->ROOM=='')) {
    if (($row->IASO=='') || ($row->OWNER=='') || ($row->OS=='') || ($row->BUILDING=='') || ($row->ROOM=='')) {
        if ($daysseen>10) {
             print '      <td nowrap bgcolor="#EED3D6"> ';
        } else {
             print '      <td nowrap bgcolor="#FE2929"> ';
        }
        $compliant='NO';
    } else {
        if ($daysseen>10) {
             print '      <td nowrap bgcolor="#D3EED3"> ';
        } else {
             print '      <td nowrap bgcolor="#18FF00"> ';
        }
        $compliant='YES';
    }
    $i = $i + 1;
    print '<a href="/iaso/right.php?COMP=';
    print $compliant . '&SERIAL=' . $row->SERIAL . '" target="rightFrame">IP Address:<b>' . trim($row->IP_ADDRESS) . '</b><BR>';
    print 'MAC Address:<b>' . trim(strtoupper($row->MAC_ADDRESS)) . '</b><BR>';
    if (strlen($row->NETBIOS_NAME)!=0) {
        print 'Netbios Name:<b>' . $row->NETBIOS_NAME . '</b><br>';
    } else {
        if (strlen($row->DNS_NAME)!=0) {
            print 'DNS Name: <b>' . $row->DNS_NAME . '</b><br>';
        }
    }
    if ($row->SYSTEM_USER != '') {
        $stmt2 = "select display_name, phone from owner where SERIAL = '$row->SYSTEM_USER';";
        $sth2 = ibase_query($dbh, $stmt2);
        if ($row2 = ibase_fetch_object($sth2)) {
            print 'User: <b>' . $row2->DISPLAY_NAME . '</b>';
        }
    } else {
        if ($row->OWNER != '') {
            $stmt3 = "select display_name, phone from owner where SERIAL = '$row->OWNER';";
            $sth3 = ibase_query($dbh, $stmt3);
            if ($row3 = ibase_fetch_object($sth3)) {
                print 'SA: <b>' . $row3->DISPLAY_NAME . '</b>';
            }
        } else {
            if ($row->PRIMARY_POC != '') {
                print 'POC: <b>' . $row->PRIMARY_POC . '</b>';
            }
        }
    }
    print '</A><BR>';
    if ($row->OS != '') {
     $stmtos = "Select o.OS, v.osversion, v.icon FROM os o, osversion v where (o.serial=v.os) order by o.os, v.osversion;";
      $sthos = ibase_query($dbh, $stmtos);
      while ($rowos = ibase_fetch_object($sthos)) {
        if ($rowos->OS != '') {
           $current_os = $rowos->OS . ' - ' . $rowos->OSVERSION;
           if (($row->OS==$current_os) && ($rowos->ICON!='')) {
              print '<img src="' . $rowos->ICON . '" alt="' . $row->OS  . ' Last Seen: ' . $row->LAST_SEEN  . '">'; }
        }
      }
    }
    if ($row->UPDATE_SERVER != '') {
        $stmtupdate = "select * from updates where arp_table = '$row->SERIAL';";
        $sthupdate = ibase_query($dbh, $stmtupdate);
        if ($rowupdate = ibase_fetch_object($sthupdate)) {
            print '<img src="update.gif" alt="On Update Server:' . $row->UPDATE_SERVER . ' Last Update: ' . $row->UPDATE_TIME . '">';
        } else {
            print '<img src="updatered.gif" alt="Error: On update server but not getting updates">';
        }
    }
    if ($row->AV_SERVER != '') {
       $lasttime = strtotime($row->LAST_SEEN);
       $diffseen = - DateDiff ("d",$currenttime , $lasttime);
       $daysseen = floor($diffseen);

       list($avirusdate, $junk) = split(" ", $row->ANTIVIRUS);
       $avirustime = strtotime($avirusdate);
       $currenttime = time();
       $diff = floor(- DateDiff ("d",$currenttime , $avirustime));
       if (($diff>10) && ($diffseen<10) && (($row->LAPTOP=='') || ($row->LAPTOP=='0'))) {
           print '<img src="shieldred.gif" alt="NAV Server: ' . $row->AV_SERVER . ' Virus Defs ' . $row->ANTIVIRUS . '  ' . $diff . 'days old">';
       } else {
           print '<img src="shield.gif" alt="NAV Server: ' . $row->AV_SERVER . ' Virus Defs ' . $row->ANTIVIRUS . '  ' . $diff . 'days old">';
       }
    }
    if ($row->CAC_TYPE!='') {
         print '<img src="cardreader.gif" alt="CAC Card Reader Installed"';
    }
    print '</td></tr></table>';
}
?>
Return current item: Network Asset Management Archive