Location: PHPKode > projects > Network Asset Management Archive > nama/liaso/printtable.php
<?php
include "../connect.php";
print '<body bgcolor="#FFFFCC">';
$now = date("j/m/y h:i:s",time());
$submit = $_POST['Submit'];
$EMAIL = $_POST['EMAIL'];
$MESSAGE = $_POST['MESSAGE'];
$IPLIST = $_POST['IPLIST'];
$SLIASO = $_POST['SLIASO'];

$ips = explode("\n",$IPLIST);
$mylist =  "'";
for ($i=0; $i<count($ips); $i++) {
  $ip = trim($ips[$i]);
  $mylist = $mylist . $ip;
  if ($i<count($ips)-2) {
     $mylist = $mylist . "','" ;
  }
}
if ($MESSAGE!='') {echo $MESSAGE . '<BR><BR>';}

$mylist = $mylist . "'";
$tablerow = "style='border-color:#DBB748; border-width:1px; border-right: 2px solid #DBB748; border-collapse: collapse; border-style:solid;'";

$stmt = 'select distinct o.display_name, o.phone, a.serial , a.ip_address, a.netbios_name, a.dns_name, a.building, a.room, a.barcode, a.last_seen, a.md5, a.os from arp_table a, owner o where (o.serial=a.iaso) and (a.ip_address in (' . $mylist . ')) order by o.display_name, a.ipnum';
//echo $stmt;
$sth = ibase_query($dbh, $stmt);
$i = -1;
$first = 0;
$iaso="";
$ip="";
while ($row = ibase_fetch_object($sth)) {
if ($iaso!=$row->DISPLAY_NAME . '   ' . $row->PHONE) {
  if ($first == 0) {
     echo '</table>';
     $first = 1;
  }
   $i = -1;
   echo '<br><b>' . $iaso  . '</b><BR>' ;
?>
<table style='border-color:#DBB748; border-width:3px; border-right: 3px solid #DBB748; border-collapse: collapse; border-style:solid;' width="700" border="2">
<?
echo "<tr BGCOLOR='#DBB748' ALIGN=left><th " . $tablerow . ">IP</th><th " . $tablerow . ">Name</th><th " . $tablerow . ">Building</th><th " . $tablerow . ">Room</th><th " . $tablerow . ">Bar Code</th><th " . $tablerow . ">OS</th><th " . $tablerow . ">Last Seen</th></tr>";
}
if ($i%2) {
   echo "<tr BGCOLOR='#F5EACB'>";
} else {
   echo "<tr>";
}
list ($lastseendate, $lastseentime) = split(" ", $row->LAST_SEEN);

if ($ip!=$row->IP_ADDRESS) {
 $i = $i + 1;
if ($i%2) {
   echo "<tr BGCOLOR='#F5EACB'>";
} else {
   echo "<tr>";
}
   echo '<td ' . $tablerow . 'width="15%"><a href="/iaso/right.php?SERIAL=' . $row->SERIAL . '" target = "_blank">' . $row->IP_ADDRESS . '</a></td>';
   if ($row->NETBIOS_NAME != '') {
       echo '<td ' . $tablerow . '>' . $row->NETBIOS_NAME . '</td>';
   } else {
       echo '<td ' . $tablerow . '>' . $row->DNS_NAME . '</td>';
   }
   echo '<td ' . $tablerow . '>' . $row->BUILDING . '</td>';
   echo '<td ' . $tablerow . '>' . $row->ROOM . '</td>';
   echo '<td ' . $tablerow . '>' . $row->BARCODE . '</td>';
   echo '<td ' . $tablerow . '>' . $row->OS . '</td>';
   echo '<td ' . $tablerow . '>' . $lastseendate . '</td>';
} else {
if ($i%2) {
   echo "<tr BGCOLOR='#F5EACB'>";
} else {
   echo "<tr>";
}
   echo '<td ' . $tablerow . '>&nbsp</td><td ' . $tablerow . '>&nbsp</td>';
}



echo '</tr>';
//$i = $i + 1;
$iaso=$row->DISPLAY_NAME . '   ' . $row->PHONE;
$ip=$row->IP_ADDRESS;
}
echo '<B>' . $iaso . '</b>';
echo "</table>";
?>

Return current item: Network Asset Management Archive