g(9)); $req = NULL; if( !isset($_SESSION["optCol"]) ) { $reqCol = "SHOW COLUMNS FROM accountinfo"; $resCol = mysql_query($reqCol, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"])); while($colname=mysql_fetch_array($resCol)) { if( strcasecmp($colname["Field"], TAG_NAME) != 0 ) $_SESSION["optCol"][] = $colname["Field"] ; } } include("req.class.php"); $indLigne=0; $softPresent = false; $cuPresent = -1; $leSelect = array_merge( array("h.id"=>"h.id", "deviceid"=>"deviceid"), $_SESSION["currentFieldList"] ); if( is_array($_SESSION["selectSofts"]) && $_POST["sub"]!=$l->g(30)) $leSelect = array_merge( $leSelect, $_SESSION["selectSofts"] ); $selFinal =""; if($_POST["reset"]==$l->g(41)) { unset($_SESSION["OPT"]); unset($_SESSION["reqs"]); unset($_SESSION["softs"]); } else if($_POST["selOpt"]) { $_POST["selOpt"] = urldecode( $_POST["selOpt"] ); if( $_POST["selOpt"]==$l->g(20) || ((! is_array($_SESSION["OPT"])) || ( !in_array($_POST["selOpt"],$_SESSION["OPT"])))) { $_SESSION["OPT"][]=stripslashes($_POST["selOpt"]); } } else if($_POST["sub"]==$l->g(30)) { unset($_SESSION["selectSofts"]); unset($_SESSION["storedRequest"], $_SESSION["c"],$_SESSION["reqs"],$_SESSION["softs"]); $i=0; $nb=0; $laRequete=""; for($i=0;$i<$_POST["max"];$i++) { if( urldecode($_POST["lbl_".$i]) == $l->g(20)) $_SESSION["softs"][] = array( $_POST["act_".$i], urldecode($_POST["chm_".$i]), $_POST["ega_".$i], strtr($_POST["val_".$i],"\"","'"), strtr($_POST["val2_".$i],"\"","'"), $_POST["valreg_".$i] ); $_SESSION["reqs"][ urldecode($_POST["lbl_".$i]) ] = array( $_POST["act_".$i], urldecode($_POST["chm_".$i]), $_POST["ega_".$i], strtr($_POST["val_".$i],"\"","'"), strtr($_POST["val2_".$i],"\"","'"), $_POST["valreg_".$i] ); if(!isset($_POST["act_".$i])) continue; /*VOIRif( ($_POST["chm_".$i]=="name") && $_POST["ega_".$i]==$l->g(129) ) { $laRequete.=", s.name AS \"".$l->g(20)."\""; }*/ $nb++; } $from = " hardware h LEFT JOIN accountinfo a ON a.hardware_id=h.id LEFT JOIN bios b ON b.hardware_id=h.id,"; //$laRequete.=" FROM hardware h,accountinfo a, bios b, "; $softTable = false ; $logIndex = 1; $fromPrelim =""; for($i=0;$i<$_POST["max"];$i++) { if(!isset($_POST["act_".$i])) continue; //jokers if( $_POST["ega_".$i] != $l->g(410) ) $_POST["val_".$i] = strtr($_POST["val_".$i], "?*", "_%"); if( isFieldDate($_POST["chm_".$i]) ) { $_POST["val_".$i] = dateToMysql($_POST["val_".$i]); } if( ($_POST["chm_".$i]=="name") && ($_POST["ega_".$i]==$l->g(129) || $_POST["ega_".$i]==$l->g(410))) { $leSelect["s".$logIndex.".name"] = $l->g(20)." $logIndex"; $_SESSION["selectSofts"]["s".$logIndex.".name"] = $l->g(20)." $logIndex"; } $regRes = null; if( ($_POST["ega_".$i]==$l->g(129)||$_POST["ega_".$i]==$l->g(410)) && $_POST["chm_".$i]=="name" ) { //$fromPrelim.=" softwares s".$logIndex.","; $from .= " softwares s".$logIndex.","; $logIndex++; } if( ($_POST["chm_".$i]=="regval" || $_POST["chm_".$i]=="regname") && ($_POST["ega_".$i]==$l->g(129)||$_POST["ega_".$i]==$l->g(410))) { $fromPrelim.=" registry r,"; } if($_POST["chm_".$i]=="smonitor") { $fromPrelim.=" monitors m,"; } if($_POST["chm_".$i]=="free") { $fromPrelim.=" drives dr,"; } if(($_POST["chm_".$i]=="ipmask"||$_POST["chm_".$i]=="ipgateway"||$_POST["chm_".$i]=="ipaddr"||$_POST["chm_".$i]=="ipsubnet"||$_POST["chm_".$i]=="macaddr") && !$netTable) { $fromPrelim.=" networks n,"; $netTable=true; } } if($fromPrelim[strlen($fromPrelim)-1]==",") $fromPrelim[strlen($fromPrelim)-1]=" "; if($from[strlen($from)-1]==",") $from[strlen($from)-1]=" "; $first = true; for($i=0;$i<$_POST["max"];$i++) { if(!isset($_POST["act_".$i])) continue; if( $_POST["act_".$i]="checked" && $_POST["chm_".$i] == "ipdisc" ) { if( !$first ) $laRequete.= " AND "; $first = false; $laRequete.= " h.id "; switch( $_POST["val_".$i] ) { case "elu": $laRequete.= "IN (SELECT hardware_id FROM devices WHERE ivalue=1 AND name='IPDISCOVER') "; break; case "for": $laRequete.= "IN (SELECT hardware_id FROM devices WHERE ivalue=2 AND name='IPDISCOVER') "; break; case "nelu": $laRequete.= "NOT IN (SELECT hardware_id FROM devices WHERE ivalue=1 AND name='IPDISCOVER') "; break; case "eli": $laRequete.= "NOT IN (SELECT hardware_id FROM devices WHERE ivalue=0 AND name='IPDISCOVER') "; break; case "neli": $laRequete.= "IN (SELECT hardware_id FROM devices WHERE ivalue=0 AND name='IPDISCOVER') "; break; } continue; } if( $_POST["act_".$i]="checked" && $_POST["chm_".$i] == "freq" ) { if( !$first ) $laRequete.= " AND "; $first = false; $laRequete.= " h.id "; switch( $_POST["val_".$i] ) { case "std": $laRequete.= "NOT IN (SELECT hardware_id FROM devices WHERE name='FREQUENCY') "; break; case "always": $laRequete.= "IN (SELECT hardware_id FROM devices WHERE name='FREQUENCY' AND ivalue=0) "; break; case "never": $laRequete.= "IN (SELECT hardware_id FROM devices WHERE name='FREQUENCY' AND ivalue=-1) "; break; case "custom": $laRequete.= "IN (SELECT hardware_id FROM devices WHERE name='FREQUENCY' AND ivalue>0) "; break; } continue; } if( $_POST["act_".$i]="checked" && $_POST["chm_".$i] == "tele" ) { if( !$first ) $laRequete.= " AND "; $first = false; $laRequete.= " h.id "; if( $_POST["ega_".$i] == "ayant" ) { $laRequete.= " IN "; } else if( $_POST["ega_".$i] == "nayant" ) { $laRequete.= " NOT IN "; } switch( $_POST["val2_".$i] ) { case "suc": $laRequete.= "(SELECT d.hardware_id FROM devices d, download_available a, download_enable e WHERE d.name='DOWNLOAD' AND a.name='".$_POST["val_".$i]. "' AND d.tvalue like 'SUCCESS_%' AND e.fileid=a.fileid AND e.id=d.ivalue) "; break; case "nsuc": $laRequete.= "(SELECT d.hardware_id FROM devices d, download_available a, download_enable e WHERE d.name='DOWNLOAD' AND a.name='".$_POST["val_".$i]. "' AND (d.tvalue not like 'SUCCESS_%' OR d.tvalue IS NULL) AND e.fileid=a.fileid AND e.id=d.ivalue) "; break; case "ind": $laRequete.= "(SELECT d.hardware_id FROM devices d, download_available a, download_enable e WHERE d.name='DOWNLOAD' AND a.name='".$_POST["val_".$i]. "' AND e.fileid=a.fileid AND e.id=d.ivalue) "; break; default: //standard case $laRequete.= "(SELECT d.hardware_id FROM devices d, download_available a, download_enable e WHERE d.name='DOWNLOAD' AND a.name='".$_POST["val_".$i]. "' AND d.tvalue='".$_POST["val2_".$i]."' AND e.fileid=a.fileid AND e.id=d.ivalue) "; break; } continue; } if( $_POST["act_".$i]="checked" && ! ( ($cuPresent != -1 ) && $_POST["chm_".$i] == "cu") ) { // cas particulier avec LOGICIEL if( ($_POST["chm_".$i] == "name" ) ) { if( $_POST["ega_".$i] == $l->g(129)||$_POST["ega_".$i]==$l->g(410) ) $softsEg[] = Array( $_POST["val_".$i], urldecode($_POST["lbl_".$i]), $_POST["ega_".$i] ); else $softsDi[] = Array( $_POST["val_".$i], urldecode($_POST["lbl_".$i]), "" ); continue ; } // cas particulier avec registry DIFFERENT DE if( $_POST["chm_".$i] == "regname" && $_POST["ega_".$i] == $l->g(130) ) { $regDiff=Array($_POST["val_".$i],$_POST["valreg_".$i]); continue ; } if($nb>0&&!$first) { $laRequete.=" AND "; } if( $first ) $first = false; $forceEgal=false; if($_POST["chm_".$i]=="regname") { $laRequete.="r.hardware_id=h.id AND "; } $tblIneq = "h"; switch($_POST["chm_".$i]) { case "ssn": $laRequete.="b.ssn";break; case "bmanufacturer": $laRequete.="b.bmanufacturer";break; case "bversion": $laRequete.="b.bversion";break; case "smanufacturer": $laRequete.="b.smanufacturer";break; case "smodel": $laRequete.="b.smodel";break; case "ipmask": $laRequete.="n.hardware_id=h.id AND n.ipmask";break; case "ipgateway": $laRequete.="n.hardware_id=h.id AND n.ipgateway";break; case "free": $laRequete.="dr.hardware_id=h.id AND dr.free";$tblIneq="dr";break; case "ipsubnet": $laRequete.="n.hardware_id=h.id AND n.ipsubnet";break; case "regname": if( $_POST["valreg_".$i] != $l->g(265) ) { if( $_POST["ega_".$i] != $l->g(410) ) $_POST["valreg_".$i] = strtr($_POST["valreg_".$i], "?*", "_%"); $comp = $_POST["ega_".$i] == $l->g(129) ? " like '%" : " = '"; $compFin = $_POST["ega_".$i] == $l->g(129) ? "%' " : "' "; $laRequete.="r.regvalue$comp".$_POST["valreg_".$i]."{$compFin}AND "; } $laRequete.="r.name"; $forceEgal=true; break; case "name": $laRequete.="s.hardware_id=h.id AND s.name"; $softPresent = true; if( $_POST["ega_".$i] == $l->g(129)||$_POST["ega_".$i]==$l->g(410) ) $unSoftnEgal = true ; break; case "ORDEROWNER": $laRequete.="a.orderowner";break; case "ORDERID": $laRequete.="a.orderid";break; case "PRODUCTID": $laRequete.="a.productid";break; case "BILLDATE": $laRequete.="a.billnbr";break; case "cu": $laRequete.="a.".TAG_NAME;$forceEgal=true;break; case "processors": $laRequete.="h.processors";break; case "memory": $laRequete.="h.memory";break; case "osname": $laRequete.="h.osname";$forceEgal=false;break; case "userid": $laRequete.="h.userid";break; case "ipaddr": $laRequete.="n.hardware_id=h.id AND n.ipaddress";break; case "macaddr": $laRequete.="n.hardware_id=h.id AND n.macaddr";break; case "useragent": $laRequete.="h.useragent";$forceEgal=true;break; case "workgroup": $laRequete.="h.workgroup";$forceEgal=true;break; case "hname": $laRequete.="h.name";break; case "description": $laRequete.="h.description";break; case "lastdate": $laRequete.="h.lastdate";break; case "smonitor": $laRequete.="m.hardware_id=h.id AND m.serial";break; default: $laRequete.="a.".$_POST["chm_".$i]; break; } if( ! $forceEgal ) { switch($_POST["ega_".$i]) { case $l->g(410): $laRequete.=" = ";$forceEgal=true; break; case $l->g(129): $laRequete.=" LIKE ";$forceLike=true; break; case $l->g(130): $laRequete.=" NOT LIKE ";$forceLike=true; break; case $l->g(346): case $l->g(201): $laRequete.="<"; $forceEgal=true; break; case $l->g(347): case $l->g(202): $laRequete.=">"; $forceEgal=true; break; case $l->g(203): $laRequete.="<'".$_POST["val2_".$i]."' AND $tblIneq.".$_POST["chm_".$i].">"; $forceEgal=true; break; //case $l->g(204): $laRequete.=">'".$_POST["val2_".$i]."' OR h.".$_POST["chm_".$i]."<";break; default: $laRequete.=" LIKE "; $forceLike=true;break; } } else $laRequete.=" = "; if( $forceEgal || !$forceLike ) $laRequete.="'".$_POST["val_".$i]."'"; else $laRequete.="'%".$_POST["val_".$i]."%'"; } } if( $nb > 0 ) { $laRequeteF=$laRequete; $logIndexEg = 1; for($ii=0;$iig(129) ? " like '%" : " = '"; $compFin = $softsEg[$ii][2] == $l->g(129) ? "%' " : "' "; $laRequeteF .= " s$logIndexEg.hardware_id=h.id AND s$logIndexEg.name$comp".$softsEg[$ii][0]."$compFin"; $selFinal .= " s$logIndexEg.hardware_id=h.id AND s$logIndexEg.name$comp".$softsEg[$ii][0]."$compFin"; $logIndexEg++; } for($ii=0;$ii=1) { if($regDiff[1]!=$l->g(265)) { $valRegR = "AND rr.regvalue = '".$regDiff[1]."'"; } if( !$first ) $laRequeteF .= " AND"; $laRequeteF .= " h.id NOT IN(SELECT DISTINCT(rr.hardware_id) FROM registry rr WHERE rr.name = '".$regDiff[0]."' $valRegR)"; } if( ! $first && $mesMachines != "" ) $laRequeteF .= " AND "; $group = " h.id"; $lbl="Recherche multicritères"; $lblChmp[0]=NULL; $selectPrelim = array("h.id"=>"h.id"); $linkId = "h.id"; $whereId = "h.id"; $countId = "h.id"; $req=new Req($lbl,$whereId,$linkId,$laRequeteF,$leSelect,$selectPrelim,$from,$fromPrelim,$group,"h.lastdate DESC",$countId,null,true,null,null,null,null,$selFinal); } } else if($_GET["redo"] || $_GET["c"] || $_GET["av"] || $_GET["page"] || isset($_GET["pcparpage"]) || isset($_GET["newcol"]) ) { $lblChmp[0]=NULL; $req=new Req($_SESSION["storedRequest"]->label,$_SESSION["storedRequest"]->whereId,$_SESSION["storedRequest"]->linkId,$_SESSION["storedRequest"]->where,$leSelect,$_SESSION["storedRequest"]->selectPrelim, $_SESSION["storedRequest"]->from,$_SESSION["storedRequest"]->fromPrelim,$_SESSION["storedRequest"]->group,$_SESSION["storedRequest"]->order,$_SESSION["storedRequest"]->countId,null,true,null,null,null,null,$_SESSION["storedRequest"]->selFinal); // Instanciation du nouvel objet de type "Req" //echo $requeteCount[0]; } if( $req != NULL ) ShowResults($req); ?>
g(31);?>:   
g(41);?>>
"; $ligne[] = array( $l->g(34),"ipaddr","hardware","",2,5,"",false,true); $ligne[] = array( $l->g(33),"workgroup","hardware","SELECT workgroup FROM hardware GROUP BY workgroup",1,1,"",false,true); foreach( $_SESSION["OPT"] as $op ) if( $op == $l->g(20) ) $ligne[] = array( $l->g(20),"name","softwares","",2,7,"",false,true); $ligne[] = array( $l->g(26),"memory","hardware","",2,3,"MO",false,false); $ligne[] = array( $l->g(35),"hname","hardware","",2,1,"",false,true); $ligne[] = array( $l->g(53),"description","hardware","",2,1,"",false,true); $ligne[] = array( $l->g(46),"lastdate","hardware","",2,2,"",true); $ligne[] = array( $l->g(357),"useragent","hardware","SELECT useragent FROM hardware GROUP BY useragent",1,1,"",false,false); $ligne[] = array( $l->g(36),"ssn","bios","",2,1,"",false,true); $ligne[] = array( $l->g(64),"smanufacturer","bios","",2,1,"",false,true); $ligne[] = array( $l->g(65),"smodel","bios","",2,1,"",false,true); $ligne[] = array( $l->g(284),"bmanufacturer","bios","",2,1,"",false,true); $ligne[] = array( $l->g(207),"ipgateway","networks","",2,5,"",false,true); $ligne[] = array( $l->g(331),"ipsubnet","networks","",2,5,"",false,true); $ligne[] = array( $l->g(95),"macaddr","networks","",2,5,"",false,true); $ligne[] = array( $l->g(25),"osname","hardware","SELECT osname FROM hardware GROUP BY osname",1,1,"",false,false); $ligne[] = array( $l->g(24),"userid","hardware","SELECT userid FROM hardware GROUP BY userid",2,1,"",false,true); $ligne[] = array( $l->g(377),"processors","hardware","",2,3,"MHZ",false,false); $ligne[] = array( $l->g(45),"free","drives","",2,3,"MB",false,false); $ligne[] = array( $l->g(257),"regname","hardware","SELECT DISTINCT(name) FROM registry",1,6,"",false,false); $ligne[] = array( $l->g(359),"smonitor","hardware","",2,1,"",false,true); $ligne[] = array( $l->g(209),"bversion","bios","",2,1,"",false,true); //HARDCODED OPTIONS $ligne[] = array( $l->g(312), "ipdisc"); $ligne[] = array( $l->g(429), "freq" ); $ligne[] = array( $l->g(512), "tele" ); //GEND $ligne[] = array( TAG_LBL,"cu","accountinfo","",2,4,"",false,false); //FGEND foreach($_SESSION["optCol"] AS $col) { if($col!="TAG"&&$col!="DEVICEID"&&$col!="HARDWARE_ID") { $isDate = isFieldDate($col); $ligne[] = array( $col,$col,"hardware","accountinfo",2,$isDate ? 2 : 1,"",$isDate,true); } } foreach( $ligne as $laLigne) { $colATrier[] = $laLigne[0]; } $indLigneSoft = 0; sort($colATrier); foreach($colATrier as $nomLigne) { foreach($ligne as $laLigne) { if($laLigne[0] == $nomLigne) { afficheLigne($laLigne); break; } } } $color=$indLigne%2==0?"#F2F2F2":"#FFFFFF"; echo "
"; if($_SESSION["OPT"]!=0) { echo ""; } echo "
"; if($_SESSION["OPT"]!=0) { echo "
".$l->g(358)."

"; } } function afficheLigne($ligne) { global $indLigne,$indLigneSoft,$l,$_POST; $label = $ligne[0]; $champ = $ligne[1]; $table = $ligne[2]; $laRequete = $ligne[3]; $combo = isset($ligne[4]) ? $ligne[4] : 1 ; $type = isset($ligne[5]) ? $ligne[5] : 1 ; $leg = isset($ligne[6]) ? $ligne[6] : "" ; $isDate = isset($ligne[7]) ? $ligne[7] : false ; $allowExact = isset($ligne[8]) ? $ligne[8] : true ; if(is_array($_SESSION["OPT"])) { if(!in_array($label,$_SESSION["OPT"])) return; } else return; $color=$indLigne%2==0?"#F2F2F2":"#FFFFFF"; $suff="_".$indLigne; if( $type == 7) {// un soft echo"  ".$l->g(205)." $label"; echo "  "; echo ""; $indLigne++; $indLigneSoft++; return; } echo"  ".$l->g(205)." $label "; if( $champ == "ipdisc" ) { echo ""; $indLigne++; return; } else if( $champ == "freq" ) { echo ""; $indLigne++; return; } else if( $champ == "tele" ) { $resTele = @mysql_query("SELECT distinct(NAME) FROM download_available", $_SESSION["readServer"]); if( mysql_num_rows( $resTele ) >0 ) { echo " ".$l->g(498).": ".$l->g(546).": "; $indLigne++; } else { echo $l->g(510); } return; } if($type != 4 && $type != 6) { echo "  "; if($combo==1) { echo ""; } else { if( $isDate ) { echo "".datePick("val$suff","act$suff"); } else echo ""; if ($type==3) // deux inputs pour "entre machin et truc" { echo "  --  "; } } if( $type == 6) { echo ""; /*$reqRes = mysql_query("SELECT DISTINCT(regvalue) FROM registry", $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"])); //todo mesmachines echo "  ".$l->g(224).":  */ echo ""; /*while($row=mysql_fetch_array($reqRes)) { if($row[0]=="") continue; $selected = $row[0]== $_SESSION["reqs"][$label][5] ?" selected":""; echo "".$row[0]."\n"; }*/ echo ""; } echo "   $leg"; $indLigne++; } function isFieldDate($nom) { if( $nom == "lastdate" ) return true; $reqType = "SELECT $nom FROM accountinfo"; if( $resType = @mysql_query($reqType, $_SESSION["readServer"])) { $valType = mysql_fetch_field($resType); return ($valType->type == "date"); } return false; } ?>