Location: PHPKode > projects > Network Asset Management Archive > nama/iaso/thisnew2.php
<script language="javascript">
var typed="";
var index=0;
var prev=0;
function s1(objSelect,e){
var letter="";
var code=(document.all)?event.keyCode:e.which;
if (code==27){ //ESC key
typed="";
window.status='';
index=prev;
objSelect.selectedIndex=index;
return true;
}
else if (code==9){ //TAB key
typed="";
window.status='';
return true;
}
else if (code==8){ //BACKSPACE key
typed=typed.substring(0,typed.length-1);
}
else letter = String.fromCharCode(code);

typed+=letter;
window.status=typed;
if (document.all) {
//for IE
return s2(objSelect);
} 
else{ 
//for NS6 and up (put a little delay to supercede the SELECT behavior of auto-selecting option on press of the first letter of the item)
setTimeout("s2(document.forms['"+objSelect.form.name+"'].elements['"+objSelect.name+"'])",1); 
}
}

function s2(objSelect){
for (var i=0;i<objSelect.options.length;i++){
if (objSelect.options[i].text.toUpperCase().indexOf(typed)==0){
objSelect.selectedIndex = i;

//remember selected index because in IE (only)...
//if the SELECT tag is "pulled-down" as you typed keys then press TAB key, it resets to the first option
//accessed and set in ONBLUR and ONCLICK event handlers of SELECT tag, respectively
index = i;

return false;
}
}
return false; //always return false
}

</script>
<?php
$now = date("m/j/y h:i:s",time());
include "../connect.php";
//phpinfo();
$REMOTE_ADDR = $_SERVER["REMOTE_ADDR"];
$SERIAL = $_GET["SERIAL"];
$now = date("j/m/y h:i:s",time());
if ($SERIAL=="") {
    $stmt = "Select O3.DISPLAY_NAME AS LIASO, o3.phone as liaso_phone,  L.DESCRIPTION, l.LAB,  A.* FROM  ARP_TABLE a, SUBNETS s7, LAB l, OWNER o3 WHERE  (L.LIASO = O3.SERIAL) AND (S7.LAB = L.SERIAL) AND (S7.SUBNET = A.SUBNET) and (IP_ADDRESS = '$REMOTE_ADDR') and (last_seen in (select max(last_seen) from arp_table where ip_address='$REMOTE_ADDR'))";
} else {
    $stmt = "Select O3.DISPLAY_NAME AS LIASO, o3.phone as liaso_phone, L.DESCRIPTION, l.LAB, A.* FROM  ARP_TABLE a, SUBNETS s7, LAB l, OWNER o3 WHERE  (L.LIASO = O3.SERIAL) AND (S7.LAB = L.SERIAL) AND (S7.SUBNET = A.SUBNET) and (a.SERIAL = '$SERIAL')";
}
$sth = ibase_query($dbh, $stmt);
//echo $stmt . "<br>";
$i = 0;
$row = ibase_fetch_object($sth);

?>
<body bgcolor="#99CCff" text="#000000">
<form name="form1" method="post" action="postthis.php">
<?
print '<input type="hidden" name="serial[]" value="' . $row->SERIAL . '">';
#if ($COMP=='YES') {
#    print '      <td nowrap bgcolor="#ffffff" background="../compliant.gif"> ';
#}
#else {
#    print '      <td nowrap bgcolor="#ffffff" background="../noncompliant.gif"> ';
#}
$i = $i + 1;
$stmtiaso="select d.DISPLAY_NAME as DN from arp_table a, subnets b, lab c, owner d where (a.serial = '$row->SERIAL') and (a.subnet=b.subnet) and (b.lab=c.serial) and (a.subnet='$row->SUBNET') and (c.liaso = d.serial);";
//echo $stmtiaso . '<br>';
$sthiaso = ibase_query($dbh, $stmtiaso);
$rowiaso = ibase_fetch_object($sthiaso);
?>
        <PRE>IP Address: 	<b><?print $row->IP_ADDRESS;?></b>		MAC Address:	<b><?print strtoupper($row->MAC_ADDRESS);?></b> 
Switch: 	<b><?print $row->SWITCH;?></b>		Switch Port:	<b><?print strtoupper($row->SWITCH_PORT);?></b> 
NAV SERVER: 	<b><?print $row->AV_SERVER;?></b>			Virus Defs:	<b><?print strtoupper($row->ANTIVIRUS);?></b>
DNS Name: 	<input type="text" name="DNS_NAME[]" value="<?print $row->DNS_NAME;?>" size="25" maxlength="25">	Netbios Name:	<input type="text" name="NETBIOS_NAME[]" value="<?print $row->NETBIOS_NAME;?>" size="25" maxlength="25">
First Seen:	<b><?print $row->FIRST_SEEN;?></b>	Last Seen:	<b><?print $row->LAST_SEEN;?></b>
LAB:		<B><?print $row->DESCRIPTION;?></b>	
LIASO:		<b><?print $row->LIASO;?></b>		     Phone:  <B><?print $row->LIASO_PHONE;?></b>
IASO:		<Select name="IASO[]" onkeydown="return s1(this,event)" on blur="this.selectedIndex=index;prev=index" onclick="index=this.selectedIndex;prev=index">
<?
$stmt2 = "SELECT  O3.DISPLAY_NAME , O3.SERIAL, o3.phone FROM  OWNER o3, IASO i, LAB l WHERE (I.LIASO_NO = L.SERIAL) AND (I.USER_NO = O3.SERIAL) and (l.LAB = '$row->LAB') order by display_name";
$sth2 = ibase_query($dbh, $stmt2);
echo '<option value="">Not Assigned</option>';
while ($row2 = ibase_fetch_object($sth2)) {
   print '<option value="' . $row2->SERIAL . '"';
   if ($row2->SERIAL==$row->IASO) {
           print " selected "; }
   print '>' . $row2->DISPLAY_NAME . ' (' . $row2->PHONE . ')' . '</option>';
}
?> </select></b>	
SA:		<Select name="OWNER[]" onkeydown="return s1(this,event)" onblur="this.selectedIndex=index;prev=index" onclick="index=this.selectedIndex;prev=index">
<?  
$stmt2 = "select SERIAL, DISPLAY_NAME, PHONE from OWNER WHERE (PERSON is null) and (DELETED='N') order by DISPLAY_NAME";
$sth2 = ibase_query($dbh, $stmt2);
echo '<option value="">Not Assigned</option>';
while ($row2 = ibase_fetch_object($sth2)) {
   print '<option value="' . $row2->SERIAL . '"';
   if ($row2->SERIAL==$row->OWNER) {
           print " selected "; }
   print '>' . $row2->DISPLAY_NAME . ' (' . $row2->PHONE . ')' . '</option>';
}
?> 
</select>
System Description: <input type="text" name="SYS_DESC[]" value="<? print $row->SYS_DESC;?>" size="50" maxlength="50">
Building:           <input type="text" name="BUILDING[]" value="<? print $row->BUILDING;?>" size="10" maxlength="10"> Room:               <input type="text" name="ROOM[]" value="<? print $row->ROOM;?>" size="10" maxlength="10"> 
Barcode Number:     <input type="text" name="BARCODE[]" value="<? print $row->BARCODE;?>" size="10" maxlength="10"> 

		    <b><?print $row->OS;?></b>
OS:	    <?  print '<select name="NOSlist[]">';
      $stmt2 = "Select o.OS, v.osversion FROM os o, osversion v where (o.serial=v.os) order by o.os, v.osversion;";
      $sth2 = ibase_query($dbh, $stmt2);
echo '<option value="">Not Assigned</option>';
      while ($row2 = ibase_fetch_object($sth2)) {
        if ($row2->OS != '') {
           $current_os = $row2->OS . ' - ' . $row2->OSVERSION;
           echo '<option value="' . $row2->OS . ' - ' . $row2->OSVERSION  . '"';  
	   if ($row->OS==$current_os) { 
              print " selected "; }
           print '>' . $row2->OS . ' - ' . $row2->OSVERSION . '</option>';
        }
      }
      print "</select>";?>

<input type="checkbox" name="webserver" value="webserver" <?if ($row->WEB_SERVER=='1') {print "checked";} ?>> WEBSERVER 
<input type="checkbox" name="pdc" value="pdc" <?if ($row->DOMAIN_CONTROLLER=='1') {print "checked";} ?>>DOMAIN CONTROLLER 
<input type="checkbox" name="laptop" value="laptop" <?if ($row->LAPTOP=='1') {print "checked";} ?>>LAPTOP 
<input type="checkbox" name="multinick" value="multinick" <?if ($row->MULTINICK=='1') {print "checked";} ?>>Multiple interface NIC 
<?
print '</pre>';
?>
Return current item: Network Asset Management Archive