//====================================================================================
// OCS INVENTORY REPORTS
// Copyleft Pierre LEMMET 2005
// Web: http://ocsinventory.sourceforge.net
//
// This code is open source and may be copied and modified as long as the source
// code is always made freely available.
// Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
//====================================================================================
//Modified on 12/13/2005
$_GET["sessid"] = isset( $_POST["sessid"] ) ? $_POST["sessid"] : $_GET["sessid"];
if( isset($_GET["sessid"])){
session_id($_GET["sessid"]);
session_start();
if( !isset($_SESSION["loggeduser"]) ) {
die("FORBIDDEN");
}
}
else
die("FORBIDDEN");
require ('preferences.php');
if (isset($_GET['systemid'])) {
$systemid = $_GET['systemid'];
if ($systemid == "")
{
echo "Please Supply A System ID";
die();
}
}
elseif (isset($_POST['systemid'])) {
$systemid = $_POST['systemid'];
}
if (isset($_GET['state']))
{
$state = $_GET['state'];
if ($state == "MAJ")
echo "\n";
}// fin if
if( isset( $_GET["suppack"] ) ) {
if( $_SESSION["justAdded"] == false )
@mysql_query("DELETE FROM devices WHERE ivalue=".$_GET["suppack"]." AND hardware_id='$systemid' AND name='DOWNLOAD'", $_SESSION["writeServer"]);
else $_SESSION["justAdded"] = false;
}
else
$_SESSION["justAdded"] = false;
$queryMachine = "SELECT * FROM hardware WHERE (ID=$systemid)";
$result = mysql_query( $queryMachine, $_SESSION["readServer"] ) or mysql_error($_SESSION["readServer"]);
$item = mysql_fetch_object($result);
echo "\n";
echo "
\n";
echo "$aff -$systemid \n";
echo " \n";
incPicker();
echo "\n";
echo "\n";
echo "\n";
// COMPUTER SUMMARY
$tdhdpb = "";
$tdhfpb = " ";
$tdhd = "";
$tdhf = ": ";
echo "";
echo "";
echo "".$tdhd.$l->g(49).$tdhf.$tdhdpb.utf8_decode($item->NAME).$tdhfpb." ";
echo "".$tdhd.$l->g(33).$tdhf.$tdhdpb.utf8_decode($item->WORKGROUP).$tdhfpb." ";
echo "".$tdhd.$l->g(46).$tdhf.$tdhdpb.dateTimeFromMysql(utf8_decode($item->LASTDATE)).$tdhfpb." ";
echo "".$tdhd.$l->g(34).$tdhf.$tdhdpb.utf8_decode($item->IPADDR).$tdhfpb." ";
echo "".$tdhd.$l->g(24).$tdhf.$tdhdpb.utf8_decode($item->USERID).$tdhfpb." ";
echo "".$tdhd.$l->g(26).$tdhf.$tdhdpb.utf8_decode($item->MEMORY).$tdhfpb." ";
echo "".$tdhd.$l->g(50).$tdhf.$tdhdpb.utf8_decode($item->SWAP).$tdhfpb." ";
echo getNetName($systemid);
echo "
";
echo "";
echo "".$tdhd.$l->g(274).$tdhf.$tdhdpb.utf8_decode($item->OSNAME).$tdhfpb." ";
echo "".$tdhd.$l->g(275).$tdhf.$tdhdpb.utf8_decode($item->OSVERSION).$tdhfpb." ";
echo "".$tdhd.$l->g(286).$tdhf.$tdhdpb.utf8_decode($item->OSCOMMENTS).$tdhfpb." ";
echo "".$tdhd.$l->g(51).$tdhf.$tdhdpb.utf8_decode($item->WINCOMPANY).$tdhfpb." ";
echo "".$tdhd.$l->g(348).$tdhf.$tdhdpb.utf8_decode($item->WINOWNER).$tdhfpb." ";
echo "".$tdhd.$l->g(111).$tdhf.$tdhdpb.utf8_decode($item->WINPRODID).$tdhfpb." ";
echo "".$tdhd.$l->g(553).$tdhf.$tdhdpb.utf8_decode($item->WINPRODKEY).$tdhfpb." ";
echo "".$tdhd.$l->g(357).$tdhf.$tdhdpb.utf8_decode($item->USERAGENT).$tdhfpb." ";
echo "
";
//*/// END COMPUTER SUMMARY
echo "";
echo "";
echo "Description: ";
echo "".utf8_decode($item->DESCRIPTION)." ";
echo " ";
echo "
";
if( isset($_GET["action"]) || isset($_POST["action_form"]) ) {
include("ajout_maj.php");
die();
}
if( ! isset($_GET["option"]) ) {
$opt = $l->g(56);
}
else {
$opt = stripslashes(urldecode($_GET["option"]));
}
$td1 = "";
$td2 = " ";
$td3 = $td2;
$td4 = " ";
$lblAdm = Array($l->g(56), $l->g(500));
$imgAdm = Array("adm", "spec");
$lblHdw = Array($l->g(54), $l->g(26), $l->g(63), $l->g(92), $l->g(61), $l->g(96), $l->g(82), $l->g(93), $l->g(271), $l->g(272));
$imgHdw = Array("processeur", "memoire","stockage","disque","video","son","reseau", "controleur", "slot","port" );
$lblSof = Array($l->g(273), $l->g(20), $l->g(211));
$imgSof = Array("bios", "logiciels", "registre");
$lblOut = Array($l->g(97),$l->g(91),$l->g(79),$l->g(270));
$imgOut = Array("moniteur", "peripherique", "imprimante", "modem");
echo " ";
echo "
";
//bleu
$cpt = 0;
foreach( $imgHdw as $im ) {
echo img($im, $lblHdw[$cpt], isAvail($lblHdw[$cpt]), $opt );
$cpt++;
}
echo "
";
//jaune
echo img($imgAdm[0],$lblAdm[0], isAvail($lblAdm[0]), $opt);
echo img($imgAdm[1],$lblAdm[1], true, $opt);
echo " ";
//rouge
$cpt = 0;
foreach( $imgSof as $im ) {
echo img($im, $lblSof[$cpt], isAvail($lblSof[$cpt]), $opt );
$cpt++;
}
//vert
$cpt = 0;
foreach( $imgOut as $im ) {
echo img($im, $lblOut[$cpt], isAvail($lblOut[$cpt]), $opt );
$cpt++;
}
echo "
";
/*for($i=0;$i<18;$i++) {
echo"".$tab[$i]." ";
if($i==8) echo" ";
}*/
echo" ";
if($_GET["tout"]==1)
{
print_inventory($systemid);
print_perso($systemid);
print_proc($systemid);
print_memories($systemid);
print_storages($systemid);
print_drives($systemid);
print_bios($systemid);
print_sounds($systemid);
print_videos($systemid);
print_inputs($systemid);
print_monitors($systemid);
print_networks($systemid);
print_ports($systemid);
print_printers($systemid);
print_controllers($systemid);
print_slots($systemid);
print_softwares($systemid);
print_modems($systemid);
print_registry($systemid);
}
switch ($opt) :
case $l->g(56) : print_inventory($systemid);
break;
case $l->g(54) : print_proc($systemid);
break;
case $l->g(26) : print_memories($systemid);
break;
case $l->g(63) : print_storages($systemid);
break;
case $l->g(92) : print_drives($systemid);
break;
case $l->g(273) : print_bios($systemid);
break;
case $l->g(96) : print_sounds($systemid);
break;
case $l->g(61) : print_videos($systemid);
break;
case $l->g(91) : print_inputs($systemid);
break;
case $l->g(97) : print_monitors($systemid);
break;
case $l->g(82) : print_networks($systemid);
break;
case $l->g(272) : print_ports($systemid);
break;
case $l->g(79) : print_printers($systemid);
break;
case $l->g(93) : print_controllers($systemid);
break;
case $l->g(271) : print_slots($systemid);
break;
case $l->g(20) : print_softwares($systemid);
break;
case $l->g(270) : print_modems($systemid);
break;
case $l->g(211) : print_registry($systemid);
break;
case $l->g(500) : print_perso($systemid);
break;
default: print_inventory($systemid);
break;
endswitch;
echo " ";
echo "";
exit;
function print_perso($systemid) {
global $l, $td1, $td2, $td3, $td4;
$i=0;
$queryDetails = "SELECT * FROM devices WHERE hardware_id=$systemid";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
echo "";
//echo " $td1 "."Libellé"." $td1 "."Valeur"." ";
while($item=mysql_fetch_array($resultDetails,MYSQL_ASSOC)) {
$optPerso[ $item["NAME"] ][ "IVALUE" ] = $item["IVALUE"];
$optPerso[ $item["NAME"] ][ "TVALUE" ] = $item["TVALUE"];
}
$ii++; $td3 = $ii%2==0?$td2:$td4;
//IPDISCOVER
echo "".(isset($optPerso["IPDISCOVER"])&&$optPerso["IPDISCOVER"]["IVALUE"]!=1?" ":" ")." ";
echo $td3.$l->g(489)."";
if( isset( $optPerso["IPDISCOVER"] )) {
if( $optPerso["IPDISCOVER"]["IVALUE"]==0 ) echo $td3.$l->g(490)."";
else if( $optPerso["IPDISCOVER"]["IVALUE"]==2 ) echo $td3.$l->g(491)." ".$optPerso["IPDISCOVER"]["TVALUE"]."";
else if( $optPerso["IPDISCOVER"]["IVALUE"]==1 ) echo $td3.$l->g(492)." ".$optPerso["IPDISCOVER"]["TVALUE"]."";
}
else {
echo $td3.$l->g(493)."";
}
if( $_SESSION["lvluser"]==SADMIN )
echo "$td3".$l->g(115)." ";
echo " ";
$ii++; $td3 = $ii%2==0?$td2:$td4;
//FREQUENCY
echo "".(isset($optPerso["FREQUENCY"])?" ":" ")." ";
echo $td3.$l->g(494)."";
if( isset( $optPerso["FREQUENCY"] )) {
if( $optPerso["FREQUENCY"]["IVALUE"]==0 ) echo $td3.$l->g(485)."";
else if( $optPerso["FREQUENCY"]["IVALUE"]==-1 ) echo $td3.$l->g(486)."";
else echo $td3.$l->g(495)." ".$optPerso["FREQUENCY"]["IVALUE"]." ".$l->g(496)."";
}
else {
echo $td3.$l->g(497)."";
}
if( $_SESSION["lvluser"]==SADMIN )
echo "$td3".$l->g(115)." ";
echo " ";
//TELEDEPLOY
$resDeploy = @mysql_query("SELECT a.name, d.tvalue,d.ivalue, e.pack_loc FROM devices d, download_available a, download_enable e
WHERE d.name='DOWNLOAD' AND e.fileid=a.fileid AND e.id=d.ivalue AND d.hardware_id=$systemid");
if( mysql_num_rows( $resDeploy )>0 ) {
while( $valDeploy = mysql_fetch_array( $resDeploy ) ) {
$ii++; $td3 = $ii%2==0?$td2:$td4;
echo "";
echo " ";
echo $td3.$l->g(498)." ".$valDeploy["name"]." (".$l->g(499).": ".$valDeploy["pack_loc"]." )";
echo $td3.$l->g(81).": ".($valDeploy["tvalue"]!=""?$valDeploy["tvalue"]:$l->g(482))."";
if( $_SESSION["lvluser"]==SADMIN )
echo "$td3 ".$l->g(122)." ";
echo " ";
}
}
if( $_SESSION["lvluser"]==SADMIN )
echo "".$l->g(501)." ";
echo "
";
}
function print_proc($systemid)
{
global $l,$td1,$td3;
print_item_header($l->g(54));
$queryDetails = "SELECT * FROM hardware WHERE (id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or mysql_error($_SESSION["readServer"]);
$item = mysql_fetch_object($resultDetails);
echo "";
echo "";
echo "$td1 ".$l->g(66)." $td1 ".$l->g(377)." $td1 ".$l->g(55)." ";
echo "";
echo "$td3".utf8_decode($item->PROCESSORT)."
$td3".utf8_decode($item->PROCESSORS)."
$td3".utf8_decode($item->PROCESSORN)."";
echo " ";
echo "
";
}
function print_videos($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM videos WHERE (hardware_id = $systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(61));
echo "";
echo " $td1 ".$l->g(49)." $td1 ".$l->g(276)." $td1 ".$l->g(26)." (MB) $td1 ".$l->g(62)." ";
while($item = mysql_fetch_object($resultDetails))
{
$ii++; $td3 = $ii%2==0?$td2:$td4;
echo "
$td3".utf8_decode($item->NAME)."
$td3".utf8_decode($item->CHIPSET)."
$td3".utf8_decode($item->MEMORY)."
$td3".utf8_decode($item->RESOLUTION)."
";
}
echo "
";
}
function print_storages($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM storages WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(63));
echo "";
echo " $td1 ".$l->g(64)." $td1 ".$l->g(65)."
$td1 ".$l->g(53)." $td1 ".$l->g(66)."
$td1 ".$l->g(67)." (MB) ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "";
echo "$td3".utf8_decode($item->MANUFACTURER)."
$td3".utf8_decode($item->MODEL)."
$td3".utf8_decode($item->DESCRIPTION)."
$td3".utf8_decode($item->TYPE)."
$td3".utf8_decode($item->DISKSIZE)." ";
echo " ";
}
echo "
";
}
function print_sounds($systemid)
{
global $l,$td1,$td2,$td3,$td4;
$queryDetails = "SELECT * FROM sounds WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(96));
echo "";
echo " $td1 ".$l->g(64)." $td1 ".$l->g(49)." $td1 ".$l->g(53)." ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "";
echo "$td3".utf8_decode($item->MANUFACTURER)."
$td3".utf8_decode($item->NAME)."
$td3".utf8_decode($item->DESCRIPTION)." ";
echo " ";
}
echo "
";
}
function print_softwares($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM softwares WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(20));
echo "";
//echo "";
echo " $td1 ".$l->g(69)." $td1 ".$l->g(49)." $td1 ".$l->g(277)." $td1 ".$l->g(295)." ";
// $td1 $rep $td1 $com ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "";
echo "$td3".htmlentities(utf8_decode($item->PUBLISHER))."
$td3".htmlentities(utf8_decode($item->NAME))."
$td3".utf8_decode($item->VERSION)."
$td3".htmlentities(utf8_decode($item->FOLDER))." ";
/* $td3".utf8_decode($item->FOLDER)."
$td3".utf8_decode($item->COMMENTS)." ";*/
echo " ";
}
echo "
";
}
function print_slots($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM slots WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(271));
echo "";
echo " $td1 ".$l->g(49)." $td1 ".$l->g(53)." $td1 ".$l->g(70)." ";
echo " ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "";
echo "$td3".utf8_decode($item->NAME)."
$td3".utf8_decode($item->DESCRIPTION)."
$td3".utf8_decode($item->DESIGNATION)."";
echo " ";
}
echo "
";
}
function print_printers($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM printers WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(79));
echo "";
echo " $td1 ".$l->g(49)." $td1 ".$l->g(278)." $td1 ".$l->g(279)." ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "
$td3".utf8_decode($item->NAME)."
$td3".utf8_decode($item->DRIVER)."
$td3".utf8_decode($item->PORT)."
";
}
echo "
";
}
function print_registry($systemid)
{
global $l, $td1, $td2, $td4, $td3;
$queryDetails = "SELECT * FROM registry WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if(mysql_num_rows($resultDetails)==0) return;
print_item_header($l->g(211));
echo "";
echo "";
echo "$td1 ".$l->g(212)."
$td1 ".$l->g(213)."
";
echo " ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "";
echo "$td3 ".utf8_decode($item->NAME)."
$td3 ".utf8_decode($item->REGVALUE)."
";
echo " ";
}
echo "
";
}
function print_ports($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM ports WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(272));
echo "";
echo " $td1 ".$l->g(66)." $td1 ".$l->g(49)." $td1 ".$l->g(88)." $td1 ".$l->g(53)." ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "
$td3".utf8_decode($item->TYPE)."
$td3".utf8_decode($item->NAME)."
$td3".utf8_decode($item->CAPTION)."
$td3".utf8_decode($item->DESCRIPTION)."
";
}
echo "
";
}
function print_networks($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM networks WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(82));
echo "";
echo " $td1 ".$l->g(53)." $td1 ".$l->g(66)."
$td1 ".$l->g(268)." $td1 ".$l->g(95)." $td1 ".$l->g(81)."
$td1 ".$l->g(34)." $td1 ".$l->g(208)." $td1 ".$l->g(207)."
$td1 ".$l->g(331)." $td1 ".$l->g(281)." ";
while($item = mysql_fetch_object($resultDetails)) {
$ii++; $td3 = $ii%2==0?$td2:$td4;
echo "
$td3".utf8_decode($item->DESCRIPTION)."
$td3".utf8_decode($item->TYPE)."
$td3".utf8_decode($item->SPEED)."
$td3".utf8_decode($item->MACADDR)."
$td3".utf8_decode($item->STATUS)."
$td3".utf8_decode($item->IPADDRESS)."
$td3".utf8_decode($item->IPMASK)."
$td3".utf8_decode($item->IPGATEWAY)."
$td3".utf8_decode($item->IPSUBNET)."
$td3".utf8_decode($item->IPDHCP)." ";
}
echo "
";
}
function print_monitors($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM monitors WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if(mysql_num_rows($resultDetails)==0) return;
print_item_header($l->g(97));
echo "";
echo " $td1 ".$l->g(64)." $td1 ".$l->g(80)." $td1 ".$l->g(360)." $td1 ".$l->g(66)." $td1 ".$l->g(36)." ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "
$td3".utf8_decode($item->MANUFACTURER)."
$td3".utf8_decode($item->CAPTION)."
$td3".utf8_decode($item->DESCRIPTION)."
$td3".utf8_decode($item->TYPE)."
$td3".utf8_decode($item->SERIAL)."
";
}
echo "
";
}
function print_modems($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM modems WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(270));
echo "";
echo " $td1 ".$l->g(49)." $td1 ".$l->g(65)." $td1 ".$l->g(53)." $td1 ".$l->g(66)." ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "
$td3".utf8_decode($item->NAME)."
$td3".utf8_decode($item->MODEL)."
$td3".utf8_decode($item->DESCRIPTION)."
$td3".utf8_decode($item->TYPE). "
";
}
echo "
";
}
function print_memories($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM memories WHERE (hardware_id=$systemid) ORDER BY capacity ASC";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(26));
echo "";
echo "";
echo "$td1 ".$l->g(80)." $td1 ".$l->g(53)." $td1 ".$l->g(83)." (MB) $td1 ".$l->g(283)."
$td1 ".$l->g(66)." $td1 ".$l->g(268)." $td1 ".$l->g(94)." ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "
$td3 ".utf8_decode($item->CAPTION)."
$td3 ".utf8_decode($item->DESCRIPTION)."
$td3 ".utf8_decode($item->CAPACITY)."
$td3 ".utf8_decode($item->PURPOSE)."
$td3 ".utf8_decode($item->TYPE)."
$td3 ".utf8_decode($item->SPEED)."
$td3 ".utf8_decode($item->NUMSLOTS)."
";
}
echo "
";
}
function print_inputs($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM inputs WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(91));
echo "";
echo "";
echo "$td1 ".$l->g(66)." $td1 ".$l->g(64)." $td1 ".$l->g(80)."
$td1 ".$l->g(53)." $td1 ".$l->g(84)." ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "
$td3 ".utf8_decode($item->TYPE)."
$td3 ".utf8_decode($item->MANUFACTURER)."
$td3 ".utf8_decode($item->CAPTION)."
$td3 ".utf8_decode($item->DESCRIPTION)."
$td3 ".utf8_decode($item->INTERFACE)."
";
}
echo "
";
}
function print_drives($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM drives WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(92));
echo "";
echo "";
echo "$td1 ".$l->g(85)." $td1 ".$l->g(66)." $td1 ".$l->g(86)."
$td1 ".$l->g(87)." (MB) $td1 ".$l->g(88)." (MB) ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "
$td3 ".utf8_decode($item->LETTER)."
$td3 ".utf8_decode($item->TYPE)."
$td3 ".utf8_decode($item->FILESYSTEM)."
$td3 ".utf8_decode($item->TOTAL)."
$td3 ".utf8_decode($item->FREE)."
";
}
echo "
";
}
function print_bios($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM bios WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(273));
echo "";
echo "$td1 ".$l->g(36)." $td1 ".$l->g(64)." $td1 ".$l->g(65)." $td1 ".$l->g(284)."
$td1 ".$l->g(209)." $td1 ".$l->g(210)." ";
$item = mysql_fetch_object($resultDetails);
echo "";
echo "$td3".utf8_decode($item->SSN)."
$td3".utf8_decode($item->SMANUFACTURER)."
$td3".utf8_decode($item->SMODEL)."
$td3".utf8_decode($item->BMANUFACTURER)."
$td3".utf8_decode($item->BVERSION)."
$td3".utf8_decode($item->BDATE)." ";
echo " ";
echo "
";
}
function print_comments($systemid)
{
global $com, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM comments WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(51));
echo "";
echo "";
echo "$td1 ".$l->g(51)."";
echo " ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "";
echo "$td3".utf8_decode($item->COMMENTS)."";
echo " ";
}
echo "
";
}
function print_controllers($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM controllers WHERE (hardware_id=$systemid)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
if ( mysql_num_rows($resultDetails) == 0 ) return;
print_item_header($l->g(93));
echo "";
echo " $td1 ".$l->g(64)." $td1 ".$l->g(49)." $td1 ".$l->g(66)." ";
while($item = mysql_fetch_object($resultDetails))
{ $ii++; $td3 = $ii%2==0?$td2:$td4;
echo "
$td3 ".utf8_decode($item->MANUFACTURER)."
$td3 ".utf8_decode($item->NAME)."
$td3 ".utf8_decode($item->TYPE)."
";
}
echo "
";
}
function print_inventory($systemid)
{
global $l, $td1, $td2, $td3, $td4;
$queryDetails = "SELECT * FROM accountinfo WHERE hardware_id=$systemid";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
$item=mysql_fetch_array($resultDetails,MYSQL_ASSOC);
if( $item ) {
$label_bouton = " ";
echo "$label_bouton ";
echo "";
echo " $td1 ".$l->g(223)." $td1 ".$l->g(224)." ";
$indType=-1;
foreach ($item as $k=>$v) {
$indType++;
if( strcasecmp($k,"DEVICEID")==0 || strcasecmp($k,"UNITID")==0|| strcasecmp($k,"HARDWARE_ID")==0)
continue;
if(strcasecmp($k,TAG_NAME)==0)
$k = TAG_LBL;
$ii++; $td3 = $ii%2==0?$td2:$td4;
if(mysql_field_type($resultDetails,$indType)=="date")
$v = dateFromMysql($v);
echo "$td3 $k$td3 $v ";
}
echo "
";
}
}
function getNetName($did) {
global $tdhd,$tdhf,$tdhdpb,$tdhfpb,$l;
//echo ""$tdhd.$l->g(50).$tdhf. $tdhdpb.VAL.$tdhfpb." ";
$reqSub = "SELECT name FROM subnet s,networks n WHERE s.netid=n.ipsubnet AND n.hardware_id=$did";
$resSub = mysql_query($reqSub, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
$indice = 1;
$returnVal = "".$tdhd.$l->g(304)." ".$indice.$tdhf;
while($valSub = mysql_fetch_array( $resSub )){
if($indice != 1) {
$returnVal .= " ".$tdhd.$l->g(304)." ".$indice.$tdhf;
}
$indice++;
$returnVal .= $tdhdpb.$valSub["name"].$tdhfpb;
}
$queryDetails = "SELECT ipsubnet FROM networks WHERE hardware_id=$did AND ipsubnet NOT IN(SELECT netid FROM subnet)";
$resultDetails = mysql_query($queryDetails, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"]));
while($item = mysql_fetch_array($resultDetails)) {
if($indice != 1) {
$returnVal .= " ".$tdhfpb.$tdhd.$l->g(304)." ".$indice.$tdhf;
}
$returnVal .= $tdhdpb.$item["ipsubnet"].$tdhfpb;
$indice++;
}
return $returnVal;
}
function print_item_header($text)
{
echo "";
echo "";
echo "".strtoupper($text)." ";
echo " ";
echo "
";
}
function img($i,$a,$avail,$opt) {
global $systemid;
if( $opt == $a ) {
$suff = "_a";
}
if( $avail ) {
$href = "";
$fhref = " ";
$img = " ";
}
else {
$href = "";
$fhref = "";
$img = " ";
}
return "".$href.$img.$fhref." ";
}
function isAvail($lbl) {
global $systemid,$l;
switch (stripslashes(urldecode($lbl))) {
case $l->g(56) : $tble = "accountinfo";
break;
case $l->g(26) : $tble = "memories";
break;
case $l->g(63) : $tble = "storages";
break;
case $l->g(92) : $tble = "drives";
break;
case $l->g(273) : $tble = "bios";
break;
case $l->g(96) : $tble = "sounds";
break;
case $l->g(61) : $tble = "videos";
break;
case $l->g(91) : $tble = "inputs";
break;
case $l->g(97) : $tble = "monitors";
break;
case $l->g(82) : $tble = "networks";
break;
case $l->g(272) : $tble = "ports";
break;
case $l->g(79) : $tble = "printers";
break;
case $l->g(93) : $tble = "controllers";
break;
case $l->g(271) : $tble = "slots";
break;
case $l->g(20) : $tble = "softwares";
break;
case $l->g(270) : $tble = "modems";
break;
case $l->g(211) : $tble = "registry";
break;
case $l->g(54): return true;
default: echo "bug";
break;
}
$resAv = mysql_query("SELECT hardware_id FROM $tble WHERE hardware_id=$systemid", $_SESSION["readServer"] );
//echo "SELECT hardware_id FROM $tble WHERE hardware_id=$systemid";
$valAvail = mysql_num_rows( $resAv );
return ($valAvail>0);
}
?>