$fipdisc ".$l->g(341)."
"; } else if( ! is_writable(".") ) { echo "
".$l->g(342)." $fipdisc
"; } } break; case 8: $_SESSION["direct"] = isset($_GET["direct"]) ? $_GET["direct"] : $_SESSION["direct"]; if( $_GET["direct"] == 2 ) $_SESSION["retour"] = "multi=3&mode=1"; else if( isset($_GET["direct"]) ) { $toPage = $_GET["direct"] == 3 ? 2 : 6 ; $_SESSION["retour"] = "multi=3&mode=$toPage&pas=".$_SESSION["pas"]; break; } default; } foreach ($_GET as $gk=>$gv) { if($gk=="rev" || $gk=="c"|| $gk=="a") continue; // $_SESSION["fromPage"] .= "&{$gk}=$gv"; TODO: c� koi ? } if( ! $scriptPresent && ! $_GET["mode"] ) { $scriptPresent = false ; } if(!isset($_GET["mode"])) { printEnTete($l->g(43)); echo "
"; echo ""; if( $scriptPresent ) { echo ""; } echo "
".$l->g(289)."
".$l->g(290)."
".$l->g(107)."
"; } else if( $_GET["mode"] == 12 ) { printEnTete($l->g(219)); echo "
<= ".$l->g(188)."
"; $req = "SELECT ip,mac,mask,date FROM netmap LEFT JOIN(networks) ON mac=macaddr WHERE macaddr IS NULL"; $reqC = "SELECT COUNT(ip) FROM netmap LEFT JOIN(networks) ON mac=macaddr WHERE macaddr IS NULL"; $requete = new Req($l->g(219),$req,$reqC,"","",""); ShowResults($requete,true,false,false,false,false); } else if( $_GET["mode"] == 9 ) { $_SESSION["fromdet"] = false; printEnTete($l->g(107)); ?>
<= g(188);?>

g(293);?>
g(294);?>
".$l->g(298).""; } else if( ! preg_match("/^([0-9]{1,3}\.){3}[0-9]{1,3}$/",$_POST["ipa"] )) { echo "
".$l->g(299)."
"; } else if( (! preg_match("/^([0-9]{1,3}\.){3}[0-9]{1,3}$/", $_POST["ipm"] )) && ((! preg_match("/^[0-9]{1,2}$/", $_POST["ipm"] ) )||($_POST["ipm"]>32)) ) { echo "
".$l->g(300)."
"; } else { $newRez = true; $exist = true; unset($_SESSION["lastTri"]); $reqDelete = "DELETE FROM subnet WHERE netid ='".$_POST["ipa"]."'"; @mysql_query( $reqDelete, $_SESSION["writeServer"] ); $reqInsert = "INSERT INTO subnet(name, id, netid, mask) VALUES ('".$_POST["nomrez"]."', '".$_POST["dpt"]."', '".$_POST["ipa"]."','".$_POST["ipm"]."')"; @mysql_query( $reqInsert, $_SESSION["writeServer"] ); if(mysql_affected_rows()>0) echo "
".$l->g(301)." (".$_POST["nomrez"]." ".$_POST["dpt"]." ".$_POST["ipa"]." / ".$_POST["ipm"].")
"; else echo "
".$l->g(362)." ".$_POST["ipa"]." ".$l->g(363)."
"; } } if( isset($_GET["delrez"])) { unset($_SESSION["lastTri"]); $reqSupp = "DELETE FROM subnet WHERE netid='".$_GET["delrez"]."';"; mysql_query( $reqSupp, $_SESSION["writeServer"]) or die(mysql_error($_SESSION["writeServer"])); echo "
".$l->g(302)." (netid :".$_GET["delrez"]." )
"; } $tab[0] = Array($l->g(295),$l->g(296),$l->g(82),$l->g(208)); $tailles = Array( 300, 30, 150,150 ); $types = Array("SORT_STRING","SORT_NUMERIC","SORT_STRING","SORT_STRING"); $reqSubnet = "SELECT name, id, netid, mask FROM subnet"; $resSubnet = mysql_query($reqSubnet, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"])); while( $valSubnet = mysql_fetch_array($resSubnet) ) { $tab[] = array( "".$valSubnet["name"]."", $valSubnet["id"],$valSubnet["netid"], $valSubnet["mask"] , ""); $exist = true; } printEnTete($l->g(303)); $tri = isset($_GET["tri"])?$_GET["tri"]:$_POST["tri"]; $ValNomRez = isset($_POST["nomrez"]) ? $_POST["nomrez"] : (isset($_GET["nomrez"]) ? $_GET["nomrez"] : "") ; $ValDpt = isset($_POST["dpt"])? $_POST["dpt"] : (isset($_GET["dpt"]) ? $_GET["dpt"] : "") ; $ValIpa = isset($_POST["ipa"])? $_POST["ipa"] : (isset($_GET["ipa"]) ? $_GET["ipa"] : "") ; $ValIpm = isset($_POST["ipm"])? $_POST["ipm"] : (isset($_GET["ipm"]) ? $_GET["ipm"] : "") ; ?>
g(304);?> :   g(305);?> :
g(34);?> :  g(208);?>:

><= g(188);?>
g(306)); echo "
"; $toPrint = $tab; if( $tri != "" ) $toPrint = trieTab($tab,$tri,$types ); printTab($toPrint,false,$tailles); } } else if( $_GET["mode"] == 10 ) { printEnTete($l->g(307)); if( isset( $_POST["subTyp"]) && $_POST["nomtyp"]!="" ) { $val = addslashes( $_POST["nomtyp"] ); unset($_SESSION["lastTri"]); $reqAddTyp = "INSERT INTO devicetype(name) VALUES('$val')"; mysql_query( $reqAddTyp , $_SESSION["writeServer"]) or die(mysql_error($_SESSION["writeServer"])); } if( isset( $_GET["deltyp"] )) { $reqDelTyp = "DELETE FROM devicetype WHERE name='".urldecode($_GET["deltyp"])."'"; mysql_query( $reqDelTyp, $_SESSION["writeServer"] ) or die(mysql_error($_SESSION["writeServer"])); } ?>
<= g(188);?>


g(308);?> :
"); $cptligne++; $exist = true; } if( $exist ) { printEnTete($l->g(309)); echo "
"; printTab($tab,false,$tailles); } } // Page with all detailed networks else if( $_GET["mode"] == 1 ) { $reqIpConf = "SELECT ivalue FROM config WHERE name='IPDISCOVER'"; $resIpConf = mysql_query( $reqIpConf, $_SESSION["readServer"] ) or die(mysql_error($_SESSION["readServer"])); $valIpConf = mysql_fetch_array( $resIpConf ); $maxIpConfig = $valIpConf["ivalue"]; if(isset($_POST["maxipd"])) { if( $_POST["maxipd"] == $l->g(215) ) { unset( $_POST["maxipd"] ); unset( $_SESSION["maxipd"] ); } else { $_SESSION["maxipd"] = $_POST["maxipd"]; } } else $_SESSION["maxipd"] = $maxIpConfig; $totNinvReq = "SELECT COUNT(DISTINCT mac) as total FROM netmap WHERE mac NOT IN (SELECT DISTINCT(macaddr) FROM networks)"; $totNinvRes = mysql_query( $totNinvReq, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"])); $totNinvVal = mysql_fetch_array( $totNinvRes ); $t[0] = Array("",$l->g(295),"","Uid","",$l->g(304),"",$l->g(364),"",$l->g(365),"",$l->g(312),"",$l->g(366)); $types = Array("","SORT_STRING","","SORT_NUMERIC","","SORT_STRING","","SORT_NUMERIC","","SORT_NUMERIC","","SORT_NUMERIC","","SORT_NUMERIC"); $tailles = Array( 0,250,0,50,0,250,0,70,0,70,0,70,0,70); $cptL = 1; $reqGateway = "SELECT ipsubnet as nbrez, COUNT(hardware_id) AS nbc FROM networks WHERE ipsubnet<>'0.0.0.0' AND description NOT LIKE '%PPP%' GROUP BY(ipsubnet)"; $strEnTete = $l->g(289)."

(".$totNinvVal["total"]." ".$l->g(219).")"; printEnTete($strEnTete); echo "
<= ".$l->g(188)."

"; $auMoinsUnRezo = false; $resGateway = mysql_query($reqGateway, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"])); while( $arrGateway = mysql_fetch_array($resGateway) ) { $auMoinsUnRezo = true; $resIpd = mysql_query("SELECT COUNT(*) AS nbi FROM devices WHERE name='IPDISCOVER' AND tvalue='".$arrGateway["nbrez"]."'", $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"])); $arrIpd = mysql_fetch_array( $resIpd ); if( ! preg_match("/^([0-9]{1,3}\.){3}[0-9]{1,3}$/",$arrGateway["nbrez"]) ) { continue ; } $masque = getMask( $arrGateway["nbrez"] ) ; $reqSubnet = "SELECT name,id,mask FROM subnet WHERE NETID='".$arrGateway["nbrez"]."'"; $resSubnet = mysql_query($reqSubnet, $_SESSION["readServer"]) or die(mysql_error()); if( $valSubnet = mysql_fetch_array( $resSubnet ) ) { $t[ $cptL ][] = ""; $t[ $cptL ][] = "".$valSubnet["name"].""; $t[ $cptL ][] = ""; $t[ $cptL ][] = $valSubnet["id"]; } else { $t[ $cptL ][] = ""; $t[ $cptL ][] = "-> ".$l->g(295)." <-"; $t[ $cptL ][] = ""; $t[ $cptL ][] = "0"; } $t[ $cptL ][] = ""; $t[ $cptL ][] = $arrGateway["nbrez"]; $t[ $cptL ][] = popup("multi=3&mode=4&pas=".urlencode($arrGateway["nbrez"])); $t[ $cptL ][] = $arrGateway["nbc"]; $reqNonInv = "SELECT COUNT(*) AS nbnoninv FROM netmap WHERE NETID='".$arrGateway["nbrez"]."' AND mac NOT IN (SELECT DISTINCT(macaddr) FROM networks) AND mac NOT IN (SELECT DISTINCT(macaddr) FROM network_devices)"; $resNonInv = mysql_query($reqNonInv, $_SESSION["readServer"]) or die(mysql_error()); if( $valNonInv = mysql_fetch_array( $resNonInv ) ) { if( $valNonInv["nbnoninv"] > 0) $t[ $cptL ][] = popup("multi=3&mode=2&pas=".$arrGateway["nbrez"]); else $t[ $cptL ][] = ""; $t[ $cptL ][] = $valNonInv["nbnoninv"].""; } else { $t[ $cptL ][] = ""; $t[ $cptL ][] = "-"; } if($arrIpd["nbi"]>0) { $t[ $cptL ][] = popup("multi=3&mode=5&pas=".urlencode($arrGateway["nbrez"])); $t[ $cptL ][] = $arrIpd["nbi"].""; } else { $t[ $cptL ][] = "" ; $t[ $cptL ][] = "0" ; } $reqSais = "SELECT COUNT(id) as nbSais FROM network_devices n,netmap a WHERE a.netid='".$arrGateway["nbrez"]."' AND n.macaddr=a.mac"; $resSais = mysql_query($reqSais, $_SESSION["readServer"]) or die(mysql_error()); if( ($valSais = mysql_fetch_array( $resSais )) && ($valSais["nbSais"] > 0)) { $t[ $cptL ][] = popup("multi=3&mode=8&direct=2&pas=".urlencode($arrGateway["nbrez"])); $t[ $cptL ][] = $valSais["nbSais"].""; } else { $t[ $cptL ][] = "" ; $t[ $cptL ][] = "0" ; } $cptL++; } $toPrint = $t; if( $auMoinsUnRezo ) { if( isset($_GET["tri"] ) ) $toPrint = trieTab($t,$_GET["tri"],$types ); printTab($toPrint,false,$tailles,true,true); } else echo "
".$l->g(42)."
"; } else if( $_GET["mode"] == 4 ) { $strEnTete = $l->g(367)." ".$_GET["pas"]."

".$nomRez; printEnTete($strEnTete); //echo "
<= ".$l->g(188)."

"; if($_GET["pas"] == ""){ $finSubnet = "is null"; } else $finSubnet = "='".$_GET["pas"]."'"; $lbl = $l->g(313)." ".$_GET["pas"]; $sql = "n.ipsubnet $finSubnet"; $whereId = "n.id"; $linkId = "n.id"; $select = array_merge( array("h.id"=>"h.id", "h.deviceid"=>"deviceid","n.ipmask"=>$l->g(208),"n.ipgateway"=>"n.ipgateway","quality"=>"quality","fidelity"=>"fidelity"), $_SESSION["currentFieldList"] ); $selectPrelim = array( "n.id"=>"n.id" ); $from = "hardware h LEFT JOIN accountinfo a ON a.hardware_id=h.id LEFT JOIN bios b ON b.hardware_id=h.id LEFT JOIN networks n ON n.hardware_id=h.id"; $fromPrelim = ""; $group = ""; $order = ""; $countId = "h.id"; $requete = new Req($lbl,$whereId,$linkId,$sql,$select,$selectPrelim,$from,$fromPrelim,$group,$order,$countId,true); ShowResults($requete,true,false,false,false); } else if( $_GET["mode"] == 5 ) { $strEnTete = $l->g(367)." ".$_GET["pas"]."

".$nomRez; printEnTete($strEnTete); //echo "
<= ".$l->g(188)."

"; if($_GET["pas"] == ""){ $finGateway = "is null"; } else $finGateway = "='".$_GET["pas"]."'"; $lbl = $l->g(314)." ".$_GET["pas"]; $sql = "d.name='IPDISCOVER' AND (d.ivalue=1||d.ivalue=2) AND d.tvalue ='".$_GET["pas"]."'"; $whereId = "d.name='IPDISCOVER' AND h.id"; $linkId = "h.id"; $select = array_merge( array("h.id"=>"h.id", "h.deviceid"=>"deviceid","quality"=>"quality","fidelity"=>"fidelity"), $_SESSION["currentFieldList"] ); $selectPrelim = array( "h.id"=>"h.id" ); $from = "hardware h LEFT JOIN accountinfo a ON a.hardware_id=h.id LEFT JOIN bios b ON b.hardware_id=h.id LEFT JOIN devices d ON d.hardware_id = h.id"; $fromPrelim = ""; $group = ""; $order = ""; $countId = "h.id"; $requete = new Req($lbl,$whereId,$linkId,$sql,$select,$selectPrelim,$from,$fromPrelim,$group,$order,$countId,true); ShowResults($requete,true,false,false,false); } // Network analyze else if( $_GET["mode"] == 3 ) { $tabBalises = Array("LABEL","UID","NETNAME","NETNUMBER"); printEnTete($l->g(315)); $buf = runCommand(); $ret = getXmlFromBuffer($buf, "NETWORK", $tabBalises ); $ret[0] = Array($l->g(295),$l->g(296),$l->g(82),$l->g(55)); $tailles = Array( "300", "20", "200", "40"); $total = 0; for( $li = 1 ; $li < sizeof( $ret ) ; $li++ ) { $link = ""; $total += $ret[$li][3]; for( $c = 0 ; $c < sizeof( $ret[ $li ] ) ; $c++ ) { $ret[$li][$c] = $link.$ret[$li][$c].""; } } echo "
".$l->g(87)." $total
"; echo "
<= ".$l->g(188)."
"; echo "

"; printTab($ret,FALSE,$tailles); } else if( $_GET["mode"] == 2 ) { if( isset($_GET["delmac"]) ) { mysql_query("DELETE FROM netmap WHERE mac='".$_GET["delmac"]."'", $_SESSION["writeServer"] ) or die(mysql_error()); } printEnTete($l->g(316)." ".$_GET["pas"]."

".$nomRez); ?>
(".$l->g(183).")
"; $t[0] = Array($l->g(34),$l->g(95),$l->g(318),$l->g(232)); $types = Array("SORT_STRING","SORT_STRING","SORT_STRING","SORT_STRING"); $cptL = 1; while( $valRez = mysql_fetch_array($resRez) ) { //$hname = gethostbyaddr($valRez["ip"]); TODO:remettre $t[ $cptL ] = array($valRez["ip"],$valRez["mac"],$valRez["name"],$valRez["date"]); $cptL++; } if( isset($_SESSION["triEnreg"]) && ! isset($_GET["tri"])) { $_GET["tri"] = $_SESSION["triEnreg"]; } if( isset($_GET["tri"] ) ) { $tri = trieTab($t,$_GET["tri"],$types ); $_SESSION["triEnreg"] = $_GET["tri"]; } else $tri = $t; printTab($tri,true,null,false,false,true); } else if( $_GET["mode"] == 6 ) { $pas = isset( $_GET["pas"] ) ? $_GET["pas"] : $_POST["pas"]; $rez = $nomRez; printEnTete($l->g(319)." $pas

$rez"); echo "
<= ".$l->g(188)."
"; $fname = "ipd/$pas.ipd"; $buf = ""; if( $_GET["nocache"] != 1 || $_SESSION["fromEnreg"] ) if( $hndl = @fopen ( $fname , "r" ) ) { $dateF = filemtime( $fname ); $dte = date( "j/m/Y \� H:m:s ", $dateF ); $txt = $l->g(320). " $dte, ".$l->g(321); echo << if ( !confirm('$txt') ) { window.location = 'index.php?multi=3&mode=6&popup=1&nocache=1&pas=$pas&nam=$nam'; } END; flush(); if( filesize ($fname) == 0 ) unlink( $fname ); else { $buf = fread($hndl, filesize ($fname)); echo "
".$l->g(322)." (".$l->g(323)." $dte)
"; fclose($hndl); } } $_SESSION["fromEnreg"] = false; $tabBalises = Array("IP","MAC","NAME","DATE","TYPE"); if( $buf == "" ) { $buf = runCommand("-cache -net=".$_GET["pas"]); } $ret = getXmlFromBuffer($buf, "HOST" , $tabBalises); $ret[0] = Array($l->g(34),$l->g(95),$l->g(318)."/NetBIOS",$l->g(232)); $tabTypes = Array("WINDOWS","LINUX","NETWORK","PHANTOM","FILTERED"); foreach( $tabTypes as $tt ) { $win = getLignes($ret, $tt, 4); if( sizeof($win) > 1 ) { echo "

".$l->g(324)." $tt

"; printTab($win,true); } } echo "
"; } else if( $_GET["mode"] == 7 ) { include_once('preferences.php'); if( ! isset($_GET["modepopup"] ) ) { printEnTete($l->g(290)); echo "
<= ".$l->g(188)."
"; ?>
g(34);?> :>  g(208);?>:>
alert('".$l->g(299)."');"; } else if( (! preg_match("/^([0-9]{1,3}\.){3}[0-9]{1,3}$/", $ipm )) && (! preg_match("/^[0-9]{2}$/", $ipm ) ) && $ipm != "") { echo ""; } else { $tabBalises = Array("DISCOVERED","DNS","INVENTORIED","IP","NETBIOS","NETNAME","NETNUM","TYPE"); $command = "-ip=".$ipa."/". ( $ipm !="" ? $ipm : "00" ); $buf = runCommand($command); $ret = getXmlFromBuffer($buf, "IP" , $tabBalises ); echo "

"; $disc = $ret[1][0]; $dns = $ret[1][1]; $inv = $ret[1][2]; $ip = $ret[1][3]; $net= $ret[1][4]; $nam = $ret[1][5]; $num = $ret[1][6];$typ = $ret[1][7]; $ipmask = $ipa." (".$l->g(208).": ". ( $ipm != "" ? $ipm : $l->g(325) ) .")"; $coulDisc = ( $disc == "yes" ? "green" : "red" ); $coulInv = ( $inv == "yes" ? "green" : "red" ); $err = $ipm !="" ? "" : "".$l->g(326).""; if( $err != "" ) $num =""; $width = isset($_GET["modepopup"]) ? "90" : "50"; echo ""; if( ! isset($_GET["modepopup"] )) { echo ""; } echo "
".$l->g(327)." $ipmask
".$l->g(328).":$disc
".$l->g(329).":$inv
".$l->g(66).":$typ
".$l->g(318).":$dns
".$l->g(330).":$net
".$l->g(304).":$nam
".$l->g(331).":$err$num

"; } } } else if( $_GET["mode"] == 8 ) { // insertion network device if( isset($_POST["pas"]) ) $_GET["pas"] = $_POST["pas"]; $_SESSION["fromEnreg"] = true; if( $_GET["direct"] != 2 && $_SESSION["retour"] != "multi=3&mode=1" ) echo "
<= ".$l->g(188)."
"; if( isset( $_POST["macaddr"] )) { // cherche l'ip correspondante $reqIp = "SELECT ip,netid FROM netmap WHERE mac = '".$_POST["macaddr"]."'"; $resIp = mysql_query($reqIp, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"])); $valIp = mysql_fetch_array( $resIp ); unset($_SESSION["lastTri"]); if( checkNetwork(addslashes($_POST["macaddr"])) ) { $reqNet = "INSERT INTO network_devices(description, type, macaddr, user) VALUES ('".addslashes($_POST["description"])."','".addslashes($_POST["type"])."','".addslashes($_POST["macaddr"])."' ,'".$_SESSION["loggeduser"]."');"; mysql_query($reqNet, $_SESSION["writeServer"]) or die(mysql_error($_SESSION["writeServer"])); } else echo "
".$_POST["macaddr"]." ".$l->g(363)."

"; } if( isset($_GET["mac"]) ) { printEnTete($l->g(333)); echo "

"; echo "
".$l->g(95).": "; if( isset($_GET["mac"]) ) { echo $_GET["mac"]; echo ""; } else echo ""; if( isset($_GET["pas"]) ) echo ""; echo "
".$l->g(53).":
".$l->g(66).":
"; } $ent = $l->g(334)." ".$l->g(368)." ".$_GET["pas"]."

".$nomRez; printEnTete($ent);echo "
"; if( isset($_GET["pas"]) ) { $sql = "a.netid='".$_GET["pas"]."'"; } $lbl = $l->g(314)." ".$_GET["pas"]; $whereId = "n.id"; $linkId = "n.id"; $select = array( "n.macaddr"=>$l->g(95), "a.ip"=>$l->g(34), "a.netid"=>$l->g(331), "n.type"=>$l->g(335), "n.description"=>$l->g(336), "n.user"=>$l->g(369)); $selectPrelim = array( "n.id"=>"n.id" ); $from = "network_devices n LEFT JOIN netmap a ON a.mac=n.macaddr"; $fromPrelim = ""; $group = ""; $order = "n.macaddr"; $countId = "n.id"; $requete = new Req($lbl,$whereId,$linkId,$sql,$select,$selectPrelim,$from,$fromPrelim,$group,$order,$countId); ShowResults($requete); } if(!$filePresent&&$_GET["mode"]==2) echo "
".$l->g(338)."
".$l->g(339)."
"; function trieTab($t,$colTri,$types) { if( sizeof($t)<=1 ) return $t; // tris invers�s if( !isset($_SESSION["orderIpdisc"]) ) $_SESSION["orderIpdisc"] = "SORT_ASC"; if( $_SESSION["lastTri"] == $colTri ) { $_SESSION["orderIpdisc"] = ($_SESSION["orderIpdisc"]=="SORT_ASC" ? "SORT_DESC" : "SORT_ASC") ; } $_SESSION["lastTri"] = $colTri; // foreach ($t[0] as $c) { $enTete[] = array_shift( $t[0] ); } array_shift( $t ); foreach($t as $ligne) { $col = 0; foreach($ligne as $case) { $inv[$col][] = $case; $col++; } } $strSort = "array_multisort("; $colNbr = 0; $strSort .= "\$inv[$colTri],".$_SESSION["orderIpdisc"].",".$types[$colTri]; foreach($inv as $col) { if( $colNbr == $colTri ) { $colNbr++; continue; } $strSort .= ",\$inv[$colNbr],"; $strSort .= $types[$colNbr] != "" ? $types[$colNbr] : "SORT_REGULAR" ; $colNbr++; } $strSort .="); "; //echo $strSort; eval($strSort); foreach($inv as $ligne) { $cl = 1; foreach($ligne as $case) { $ret[$cl][] = $case; $cl++; } } $ret[0] = $enTete ; return $ret; } function printTab($t ,$modeReg=false, $tailles=null, $unSurDeux=false, $scroll = false, $modeDel = false) { global $_GET; $lesget=""; foreach($_GET as $nom=>$val) { if($nom == "tri"||$nom == "delrez") continue; $lesget.="&$nom=".urlencode($val); } if( $scroll ) { $ftd = "
"; echo "
"; $col = 0; foreach($t[0] as $case) { if( $unSurDeux && $col%2==0 ) { $col++; continue; } $taille = $tailles!=null ? $tailles[$col] : "200px" ; $tdsp = "
"; echo "$tdsp$case$ftd"; $col++; } echo "
"; } else echo "
"; global $l; $totCol = sizeof( $t[0] ); $_SESSION["history"] = 0 ; echo ""; $td = ""; } else echo ""; for( $col=0 ; $col < sizeof($t[$ligne]) ; $col++) { $c = $t[$ligne][$col]; if( $unSurDeux && $col%2==0 ) { $ah = $c; continue; } if($ligne==0) { $taille = $tailles!=null ? $tailles[$col] : "200px" ; $tdsp = ""; else if( $_GET["mode"] == 6 ) echo ""; else echo ""; } if( $modeDel ) { if($ligne==0) echo ""; else echo ""; } echo ""; $ligne++; } echo "
"; $lnum = 0 ; $ligne = 0; while( isset($t[$ligne]) ) { // chque ligne if($ligne==0) { echo "
"; echo "$tdsp$c$ftd"; } else { echo $td.$ah.$c.$ftd; } } if( $modeReg ) { if($ligne==0) echo "".$l->g(114)." 
"; } function runCommand($command="") { global $l; $command = "perl ipdiscover-util.pl $command -xml -h=".$_SESSION["SERVEUR_SQL"]." -u=".$_SESSION["COMPTE_BASE"]." -p=".$_SESSION["PSWD_BASE"]; //echo $command."
"; $fd = popen($command,"r"); if($fd==FALSE) { echo "pas de handle"; return FALSE; } $buffer = ""; while (!feof($fd)) { $buffer .= fgets($fd, 4096); } pclose ($fd); if($buffer == "") { echo "
".$l->g(337)."
"; return FALSE; } else if( strstr ( $buffer, "ERROR")) { $tabBalises[] = "MESSAGE"; $ret = getXmlFromBuffer($buffer, "ERROR" , $tabBalises); echo "
".$l->g($ret[1][0])."
"; return FALSE; } return $buffer; } function getXmlFromBuffer($buffer, $baliseLigne , $balisesInt) { $ret = null; $p = xml_parser_create(); xml_parse_into_struct($p,$buffer,$vals,$index); xml_parser_free($p); $ligne = 1; foreach($vals as $val) { if( $val["tag"] == $baliseLigne && $val["type"] == "open" ) { $cOuvert = true; continue; } if( $val["tag"] == $baliseLigne && $val["type"] == "close" ) { $cOuvert = false; $ligne++; continue; } if( in_array($val["tag"],$balisesInt) && $val["type"] == "complete" && $cOuvert ) { $temp = array_flip ( $balisesInt ); $ret[$ligne][ $temp[ $val["tag"] ] ] = $val["value"]; } } return $ret; } function getLignes($t, $val, $saufCol=null) { if( isset($saufCol) ) { unset( $t[0][$saufCol] ); } $ret[] = $t[0]; for( $l = 1 ; $l < sizeof( $t ) ; $l++ ) { for( $c = 0 ; $c < sizeof( $t[$l] ) ; $c++ ) { if( $t[$l][$c] == $val || $val == -1 ) { if( isset($saufCol) ) { unset( $t[$l][$saufCol] ); } $ret[] = $t[$l]; } } } return $ret; } function getMask( $ip ) { $reqMsk = "SELECT ipmask FROM networks WHERE ipsubnet='$ip' AND ipmask <>''"; $resMsk = mysql_query( $reqMsk, $_SESSION["readServer"] ) or die( mysql_error($_SESSION["readServer"]) ); while( $ligMsk = mysql_fetch_array( $resMsk ) ) { if( preg_match("/^([0-9]{1,3}\.){3}[0-9]{1,3}$/",$ligMsk[0]) ) { return $ligMsk[0]; } } } function popup($val) { global $l,$nbpop; $nbpop++; return ""; } function getNameFromRes($nbrez) { $reqSub = "SELECT name FROM subnet s WHERE s.netid='$nbrez'"; $resSub = mysql_query($reqSub, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"])); if($valSub = mysql_fetch_array( $resSub )){ return $valSub["name"]; } return ""; } function checkNetwork($mac) { $reqMac = "SELECT id FROM network_devices WHERE macaddr='$mac'"; $resMac = mysql_query( $reqMac, $_SESSION["readServer"] ) or die(mysql_error(mysql_error($_SESSION["readServer"]))); return( mysql_num_rows( $resMac ) == 0 ); } ?>