$val ) $_SESSION["queryString"] .= "&".$key."=".$val; } require('dbconfig.inc.php'); include("fichierConf.class.php"); if(isset($_GET["lang"])) { $_SESSION["langueFich"] = "languages/".$_GET["lang"].".txt"; unset($_SESSION["availFieldList"], $_SESSION["currentFieldList"]); setcookie( "lang", $_GET["lang"], time() + 3600 * 24 * 365 ); //expires in 365 days if( isset( $_COOKIE["col"] ) ) { foreach( $_COOKIE["col"] as $key=>$val ) { setcookie( "col[$key][value]", FALSE, time() - 3600 ); // deleting corresponding cookie setcookie( "col[$key][rang]", FALSE, time() - 3600 ); // deleting corresponding cookie } unset( $_COOKIE["col"] ); } } define("GUI_VER", "4020"); define("SADMIN", 1); define("LADMIN", 2); define("ADMIN", 3); define("PC_PAR_PAGE", 15); // default computer / page value define("TAG_NAME", "tag"); // do NOT change define("LOCAL_SERVER", $_SESSION["SERVEUR_SQL"]); // adress of the server handler used for local import $_SESSION["SERVER_READ"] = $_SESSION["SERVEUR_SQL"]; $_SESSION["SERVER_WRITE"] = $_SESSION["SERVEUR_SQL"]; unset( $_SESSION["debug"] ); $_SESSION["debug"] = false ; // DB NAME define("DB_NAME", "ocsweb"); ////////// define("TAG_LBL", "Tag"); define("DEFAULT_LANGUAGE", "" ); if( isset($_COOKIE["lang"]) ) $l = new FichierConf($_COOKIE["lang"]); else $l = new FichierConf(DEFAULT_LANGUAGE?DEFAULT_LANGUAGE:getBrowserLang()); dbconnect(); if(!isset($_SESSION["rangCookie"])) $_SESSION["rangCookie"] = 0; // available columns if( ! isset($_SESSION["availFieldList"]) ) { $_SESSION["availFieldList"] = array(); $translateFields = array ( "a.".TAG_NAME=>TAG_LBL, "h.lastdate"=>$l->g(46), "h.name"=>$l->g(23), "h.userid"=>$l->g(24), "h.osname"=>$l->g(25), "h.memory"=>"Ram(MO)", "h.processors"=>"CPU(MHz)", "h.workgroup"=>$l->g(33), "h.osversion"=>$l->g(275), "h.oscomments"=>$l->g(286), "h.processort"=>$l->g(350), "h.processorn"=>$l->g(351), "h.swap"=>"Swap", "lastcome"=>$l->g(352), "h.quality"=>$l->g(353), "h.fidelity"=>$l->g(354),"h.description"=>$l->g(53), "h.wincompany"=>$l->g(355), "h.winowner"=>$l->g(356), "h.useragent"=>$l->g(357), "b.smanufacturer"=>$l->g(64), "b.bmanufacturer"=>$l->g(284),"b.ssn"=>$l->g(36),"b.smodel"=>$l->g(65),"b.bversion"=>$l->g(209),"h.ipaddr"=>$l->g(34)); $reqAc = "SHOW COLUMNS FROM accountinfo"; $reqB = "SHOW COLUMNS FROM bios"; $reqHw = "SHOW COLUMNS FROM hardware"; $resAc = mysql_query($reqAc, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"])); $resB = mysql_query($reqB, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"])); $resHw = mysql_query($reqHw, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"])); $lesCols = array(); while($colname=mysql_fetch_array($resAc)) $lesCols[] = Array( "pref"=>"a", "val"=>strtolower( $colname["Field"] )); while($colname=mysql_fetch_array($resB)) $lesCols[] = Array( "pref"=>"b", "val"=>strtolower( $colname["Field"] )); while($colname=mysql_fetch_array($resHw)) $lesCols[] = Array( "pref"=>"h", "val"=>strtolower( $colname["Field"] )); foreach( $lesCols as $laCol ) { if( in_array( $laCol["val"] , array("deviceid","id","checksum","hardware_id","etime","type") )) continue; if( isset( $translateFields[ $laCol["pref"].".".$laCol["val"] ] ) ) $translated = $translateFields[ $laCol["pref"].".".$laCol["val"] ]; else $translated = ucfirst( $laCol["val"] ); $_SESSION["availFieldList"][$laCol["pref"].".".$laCol["val"]] = $translated; } array_multisort($_SESSION["availFieldList"]); // Registry /* $reqReg = "SELECT DISTINCT name FROM registry"; $resReg = mysql_query($reqReg, $_SESSION["readServer"]) or die(mysql_error($_SESSION["readServer"])); while($colname=mysql_fetch_array($resReg)) { $_SESSION["availRegistry"][] = $colname["name"]; } array_multisort($_SESSION["availRegistry"]); */ } if(!isset($_SESSION["currentFieldList"])) {// gui just launched if( isset( $_COOKIE["col"] ) ) { // columns cookie set ? // YES: load it foreach( $_COOKIE["col"] as $key=>$val ) { //sorting cookies by "rang" $cookSort[] = array("rang"=>$val["rang"],"name"=>$key, "value"=>urldecode($val["value"])); if( $val["rang"] > $_SESSION["rangCookie"] ) $_SESSION["rangCookie"] = $val["rang"]; } sort($cookSort); foreach( $cookSort as $val ) { // loading ordered values $_SESSION["currentFieldList"][$val["name"]] = stripslashes($val["value"]); } } else {// load default values $_SESSION["currentFieldList"] = array("a.".TAG_NAME=>TAG_LBL,"h.lastdate"=>$l->g(46),"h.name"=>$l->g(23), "h.userid"=>$l->g(24),"h.osname"=>$l->g(25),"h.memory"=>"Ram(MO)","h.processors"=>"CPU(MHz)"); $_SESSION["rangCookie"] = 0; foreach( $_SESSION["currentFieldList"] as $key=>$val ) { setcookie( "col[$key][value]", $val, time() + 3600 * 24 * 365 ); //expires in 365 days setcookie( "col[$key][rang]", $_SESSION["rangCookie"], time() + 3600 * 24 * 365 ); //expires in 365 days $_SESSION["rangCookie"]++; } } } if(isset($_GET["suppCol"])) { // a column must be removed $keyName = array_search( stripslashes($_GET["suppCol"]), $_SESSION["currentFieldList"] ); // look for the column's key if( $keyName ) { // found setcookie( "col[$keyName][value]", FALSE, time() - 3600 ); // deleting corresponding cookie setcookie( "col[$keyName][rang]", FALSE, time() - 3600 ); // deleting corresponding cookie unset( $_SESSION["storedRequest"]->select[$keyName] ); unset($_SESSION["currentFieldList"][ $keyName ]); if( ! isset($_COOKIE["col"]) ) { // no cookie was previously set $_SESSION["rangCookie"] = 0; foreach( $_SESSION["currentFieldList"] as $key=>$val ) { setcookie( "col[$key][value]", $val, time() + 3600 * 24 * 365 ); //expires in 365 days setcookie( "col[$key][rang]", $_SESSION["rangCookie"], time() + 3600 * 24 * 365 ); //expires in 365 days $_SESSION["rangCookie"]++; } } } } if( isset($_GET["resetcolumns"]) && $_GET["resetcolumns"] == $l->g(396) ) { $_SESSION["currentFieldList"] = array("a.".TAG_NAME=>TAG_LBL,"h.lastdate"=>$l->g(46),"h.name"=>$l->g(23), "h.userid"=>$l->g(24),"h.osname"=>$l->g(25),"h.memory"=>"Ram(MO)","h.processors"=>"CPU(MHz)"); foreach( $_SESSION["availFieldList"] as $key=>$val ) { setcookie( "col[$key][value]", FALSE, time() - 3600 ); // deleting corresponding cookie setcookie( "col[$key][rang]", FALSE, time() - 3600 ); // deleting corresponding cookie } $_SESSION["rangCookie"] = 0; foreach( $_SESSION["currentFieldList"] as $key=>$val ) { setcookie( "col[$key][value]", $val, time() + 3600 * 24 * 365 ); //expires in 365 days setcookie( "col[$key][rang]", $_SESSION["rangCookie"], time() + 3600 * 24 * 365 ); //expires in 365 days $_SESSION["rangCookie"]++; } } else if(isset($_GET["newcol"])) { // new column $valName = stripslashes($_GET["newcol"]); //if( ! ereg("$Registry (.*)", $valName, $res) ) { $keyName = array_search( $valName, $_SESSION["availFieldList"] ); // look for the column's key if( $keyName ) { // found $_SESSION["rangCookie"]++; $value = $_SESSION["availFieldList"][$keyName]; setcookie("col[$keyName][value]", $value, time() + 3600 * 24 * 365 ); //expires in 365 days setcookie("col[$keyName][rang]", $_SESSION["rangCookie"], time() + 3600 * 24 * 365 ); //expires in 365 days $_SESSION["currentFieldList"] = array_merge($_SESSION["currentFieldList"], array( $keyName=>$value)); $_SESSION["storedRequest"]->select[$keyName] = $value; } /*} else { $_SESSION["currentRegistry"][] = $res[1]; }*/ } $boutOver="onmouseover=\"this.style.background='#FFFFFF';\" onmouseout=\"this.style.background='#C7D9F5'\""; function dbconnect() { $db = DB_NAME; $link=@mysql_connect($_SESSION["SERVER_READ"],$_SESSION["COMPTE_BASE"],$_SESSION["PSWD_BASE"]); if(!$link) { echo "
ERROR: MySql connection problem
".mysql_error()."
"; die(); } if( ! @mysql_select_db($db,$link)) { include('install.php'); die(); } $link2=@mysql_connect($_SESSION["SERVER_WRITE"],$_SESSION["COMPTE_BASE"],$_SESSION["PSWD_BASE"]); if(!$link2) { echo "
ERROR: MySql connection problem
".mysql_error($link2)."
"; die(); } if( ! @mysql_select_db($db,$link2)) { include('install.php'); die(); } $_SESSION["writeServer"] = $link2; $_SESSION["readServer"] = $link; return $link2; } function ShowResults($req,$sortable=true,$modeCu=false,$modeRedon=false,$deletableP=true,$registrable=false,$teledeploy=false, $affect=false) { global $l, $_GET; $deletable = ($_SESSION["lvluser"]==SADMIN) && $_GET["multi"]!=2 && $deletableP; global $pcparpage; $columneditable = $req->columnEdit; if( ! $affect ) unset( $_SESSION["saveRequest"] ); $ind=0; $var="option".$ind; while(isset($_POST[$var])) { if($req->isNumber[$ind]) $_POST[$var]=0+$_POST[$var];// si un nombre est attendu, on transforme en nombre $req->where=str_replace("option$ind",$_POST[$var],$req->where); // on remplace les strings "optionX" de la requete par leurs valeurs présentes dans les variables en POST $ind++; $var="option".$ind; } if( isset($_SESSION["storedRequest"]) && ( (isset($_GET["c"])&&$_GET["c"]) || $_GET["av"] == 1 || $_GET["suppCol"] == 1 || isset($_GET["newCol"])) ) { if($_SESSION["c"]==$_GET["c"]) { // If same column is sorted again if( $_GET["rev"] == 1 ) $_GET["a"]= $_GET["a"] ? 0 : 1 ; } else { $_SESSION["c"]=$_GET["c"]; $_GET["a"]= 1; } $suffixe = $_GET["a"] ? " ASC" : " DESC"; $count = getCount( $_SESSION["storedRequest"] ); $pcParPage = $modeCu ? $count : $pcparpage ; $pcParPage = $pcParPage>0 ? $pcParPage : PC_PAR_PAGE; $numPages = ceil($count/$pcParPage); if( $numPages == 0 ) $numPages++; if( $_SESSION["pageCur"] > $numPages ){ $_SESSION["pageCur"] = $numPages ; } $beg = ($_SESSION["pageCur"]-1) * $pcParPage; if ( $_GET["c"] ) { $ord = stripslashes($_GET["c"]).$suffixe; $_SESSION["storedRequest"]->order = $ord; $toExec = getQuery( $_SESSION["storedRequest"], " {$beg},".$pcParPage ) ; } else { $toExec = getQuery( $_SESSION["storedRequest"], " {$beg},".$pcParPage ) ; } } else { $count = getCount($req); $pcParPage = $modeCu ? $count : $pcparpage ; $pcParPage = $pcParPage>0 ? $pcParPage : PC_PAR_PAGE; $numPages = ceil($count/$pcParPage); if( $numPages <= 0 ) $numPages++; if( $_SESSION["pageCur"] > $numPages || ! $_SESSION["pageCur"]){ $_SESSION["pageCur"] = $numPages ; } if( $columneditable && ! $req->order ) $orderDefault = isset($_SESSION["currentFieldList"]["h.lastdate"]) ? " h.lastdate DESC" : " 1 ASC"; $beg = ($_SESSION["pageCur"]-1) * $pcParPage; if( ! $req->order ) $req->order = $orderDefault; $toExec = getQuery( $req, " {$beg},".$pcParPage ) ; $_SESSION["storedRequest"]=$req; } $result = mysql_query( $toExec, $_SESSION["readServer"] ) or die(mysql_error($_SESSION["readServer"])); //les GET a rajouter $pref=""; foreach ($_GET as $gk=>$gv) { if($gk=="page" || $gk=="rev" || $gk == "logout" || $gk=="c"|| $gk=="direct"|| $gk=="supp" || $gk=="a"|| $gk=="suppCol" || $gk=="newcol" || $gk=="resetcolumns") continue; $pref .= "&{$gk}=".urlencode($gv); } //les GET globaux a rajouter $prefG=""; $hiddens =""; foreach ($_GET as $gk=>$gv){ if( $gk=="rev"|| $gk=="suppCol"|| $gk=="supp" || $gk == "logout" || $gk=="newcol" || $gk=="page" || $gk=="resetcolumns") continue; if( $gk =="page" && ($gv==-1 || $gv==-2)) { $gv = $_SESSION["pageCur"]; } $prefG .= "&{$gk}=".urlencode(stripslashes($gv)); $hiddens .= "\n"; } if( !$modeCu && $count > 0) { echo "
"; $machNmb = array(5,10,15,20,50,100); echo ""; if( $columneditable) { echo ""; } echo "
".$count." ".$l->g(90).""; echo "
  (".$l->g(183).")
$hiddens".$l->g(340). ": 
"; echo $hiddens; echo "

"; } if($modeRedon) { echo "

"; } $cpt=1; printNavigation( $prefG, $numPages); echo ""; if($modeRedon) echo ""; if(!isset($_GET["c"])) { $_SESSION["storedRequest"]=$req; } else $_SESSION["c"]=$_GET["c"]; if($deletable) {?> countId == "h.id" ) //computer in devices echo ""; while($colname=mysql_fetch_field($result)) // On récupère le nom de toutes les colonnes { if($colname->name!="h.id"&&$colname->name!="deviceid") { $a = ( isset($_GET["a"]) ? $_GET["a"] : 0 ) ; $isDate[$colname->name] = ($colname->type == "date" ? 1 : 0); $isDateTime[$colname->name] =($colname->type == "datetime" || $colname->type == "timestamp" ? 1 : 0); if($sortable) { if( $_SESSION["storedRequest"]->countId == "h.id" && ($_SESSION["storedRequest"]->group == "" || ! in_array($_SESSION["storedRequest"]->group, array("h.id","s.name","a.tag") ) )) { // NO group by clause $vraiNomChamp = array_search( $colname->name, $_SESSION["currentFieldList"] ); /*if( ! $vraiNomChamp ) { $ind = array_search( $colname->name, $_SESSION["currentRegistry"] ); $vraiNomChamp = urlencode("\"".$_SESSION["currentRegistry"][$ind]."\""); }*/ if( ! $vraiNomChamp ) $vraiNomChamp = array_search( $colname->name, $_SESSION["storedRequest"]->select ); } else $vraiNomChamp = "\"".$colname->name."\""; //echo "if( $vraiNomChamp == ".$_SESSION["c"]." || \"\'\".".$colname->name.".\"\'\" == ".$_SESSION["c"]." ) \";"; echo ""; // Affichage en tete colonne*/ } else echo ""; // Affichage en tete colonne $tabChamps[$cpt]=$colname->name; } $cpt++; } if( ($deletable||$modeRedon) && $req->countId == "h.id" ) //computer in devices { echo ""; } if( $teledeploy ) { echo ""; } else if( $affect ) { echo ""; if( $affect != 2 ) echo ""; } echo ""; $x=-1; $nb=0; $uneMachine=false; while($item = mysql_fetch_array($result)) // Parcour de toutes les lignes résultat { flush(); echo ""; // on alterne les couleurs de ligne $x = ($x == 1 ? 0 : 1) ; $nb++; if($modeRedon) { echo ""; } if( $req->countId == "h.id" ) { //computer in devices $resDev = @mysql_query("SELECT * FROM devices WHERE (name<>'IPDISCOVER' || ivalue<>1) AND hardware_id = ".$item["h.id"], $_SESSION["readServer"]); if( mysql_num_rows( $resDev ) > 0) echo ""; else echo ""; } foreach($tabChamps as $chmp) {// Affichage de toutes les valeurs résultats echo "\n"; else if( $isDateTime[$chmp] ) echo dateTimeFromMysql($item[$chmp])."\n"; else if(!$toutAffiche) echo $item[$chmp]."\n"; } if( $deletable && isset($item["h.id"]) ) { echo ""; } else if( $deletable && isset($item[$l->g(95)]) ) { echo ""; } if( $teledeploy ) { echo ""; } else if( $affect ) { echo ""; echo ""; if( $affect != 2) echo ""; } if( $registrable && isset($item["mac"]) ) echo ""; echo ""; } echo"
   "; else echo "$hrefSort"; } else { mb_ereg( "\"? *([^\"]*)\"? (DESC|ASC)", $_SESSION["storedRequest"]->order, $res); //echo "colname:".$colname->name."vrainomchamp:".$vraiNomChamp; //var_dump( $res ); if( $res[1] == $colname->name || $res[1] == $vraiNomChamp ) if( $res[2] == "ASC" ) echo "$hrefSort"; else echo "$hrefSort"; } echo ""; if( sizeof($_SESSION["storedRequest"]->select)>3 && $columneditable && in_array( $colname->name , $_SESSION["currentFieldList"])) echo ""; echo "
"; $hrefSort = ""; if( isset($_SESSION["c"]) && ($vraiNomChamp == $_SESSION["c"] || "\'".$colname->name."\'" == $_SESSION["c"]) ) { if($a == 1 ) echo "$hrefSort{$hrefSort}{$colname->name}name)."> 
$colname->name
  ".$l->g(431)."Stats".$l->g(122)."".$l->g(432)."".$l->g(433)."
 "; if($chmp==TAG_LBL) { $leCuPrec=$item[$chmp]; } else if($chmp==$l->g(23) && isset($item["h.id"])) { echo ""; $uneMachine=true; } else if($chmp==$l->g(28)) { echo ""; } if( $isDate[$chmp] ) echo dateFromMysql($item[$chmp])."
"; if($modeRedon) { echo "
"; } if($x==-1) { echo "
".$l->g(42)."
"; } if( $uneMachine ) { if( $_SESSION["lvluser"]==SADMIN ) { echo "
".$l->g(430).":"; echo "  ".$l->g(429).""; //echo "  ".$l->g(312).""; echo "  ".$l->g(428).""; echo "  ".$l->g(122).""; echo "
"; } } printNavigation( $prefG, $numPages); return $nb; } function getCount( $req ) { $ech = $_SESSION["debug"]; $reqCount = "SELECT count(distinct ".$req->countId.") AS cpt FROM ".$req->from.($req->fromPrelim?",":"").$req->fromPrelim; if( $req->where ) $reqCount .= " WHERE ".$req->where; if($ech) echo "
$reqCount

"; $resCount = mysql_query($reqCount); $valCount = mysql_fetch_array($resCount); return $valCount["cpt"]; } function getPrelim( $req, $limit=NULL ) { $ech = $_SESSION["debug"]; $rac = "LEFT JOIN accountinfo a ON a.hardware_id=h.id"; $selectReg = ""; // $selectFin = $req->getSelect(); //$fromFin = $req->from; $cpt = 1; /*if( is_array($_SESSION["currentRegistry"]) ) foreach( $_SESSION["currentRegistry"] as $regist ) { $selectReg .= ", regAff{$cpt}.regvalue AS \"$regist\""; $fromReg.= "LEFT JOIN registry regAff{$cpt} ON regAff{$cpt}.hardware_id=h.id"; if( $cpt > 1 ) $whereReg .= " AND "; $whereReg .= "regAff{$cpt}.name='".$regist; $cpt ++; }*/ $selPrelim = $req->getSelectPrelim(); $fromPrelim = $req->from; $reqPrelim = "SELECT $selPrelim FROM ".$fromPrelim.($req->fromPrelim?",":"").$req->fromPrelim; if( $req->where ) $reqPrelim .= " WHERE ".$req->where; if( $req->group ) $reqPrelim .= " GROUP BY ".$req->group; // bidouille if( strstr( $req->order, "ipaddr" ) ) { if( strstr( $req->order, "DESC" ) ) { $order = "inet_aton(h.ipaddr) DESC"; } else { $order = "inet_aton(h.ipaddr) ASC"; } } else $order = $req->order; if( $req->order ) $reqPrelim .= " ORDER BY ".$order; if( $limit ) $reqPrelim .= " LIMIT ".$limit; if($ech) echo "
$reqPrelim

"; flush(); return $reqPrelim; } function getQuery( $req, $limit ) { $ech = $_SESSION["debug"]; $resPrelim = mysql_query( getPrelim( $req, $limit ) , $_SESSION["readServer"]); $selFin = $req->getSelect(); $fromFin = $req->from ; $toExec = "SELECT ".$selFin." FROM ".$fromFin; $prem = true; while( $valPrelim = mysql_fetch_array($resPrelim) ) { if( !$prem) $lesIn .= ","; $lesIn .= "'".addslashes($valPrelim[$req->linkId])."'"; $prem = false; } if( !$prem ) { $toExec .= " WHERE ".$req->whereId." IN($lesIn) "; if( $req->selFinal ) $toExec .= $req->selFinal; } else $toExec .= " WHERE 1=0"; if( $req->group ) $toExec .= " GROUP BY ".$req->group; // bidouille if( strstr( $req->order, "ipaddr" ) ) { if( strstr( $req->order, "DESC" ) ) { $order = "inet_aton(h.ipaddr) DESC"; } else { $order = "inet_aton(h.ipaddr) ASC"; } } else $order = $req->order; if( $req->order ) $toExec .= " ORDER BY ".$order; if($ech) echo "
$toExec

"; flush(); return $toExec; } function printEnTete($ent) { echo "
".$ent."
"; } function dateOnClick($input, $checkOnClick=false) { global $l; $dateForm = $l->g(269) == "%m/%d/%Y" ? "MMDDYYYY" : "DDMMYYYY" ; if( $checkOnClick ) $cOn = ",'$checkOnClick'"; $ret = "OnClick=\"javascript:NewCal('$input','$dateForm',false,24{$cOn});\""; return $ret; } function datePick($input, $checkOnClick=false) { global $l; $dateForm = $l->g(269) == "%m/%d/%Y" ? "MMDDYYYY" : "DDMMYYYY" ; if( $checkOnClick ) $cOn = ",'$checkOnClick'"; $ret = ""; $ret .= "\"Pick"; return $ret; } function dateFromMysql($v) { global $l; if( $l->g(269) == "%m/%d/%Y" ) $ret = sprintf("%02d/%02d/%04d", $v[5].$v[6], $v[8].$v[9], $v); else $ret = sprintf("%02d/%02d/%04d", $v[8].$v[9], $v[5].$v[6], $v); return $ret; } function dateTimeFromMysql($v) { global $l; if( $l->g(269) == "%m/%d/%Y" ) $ret = sprintf("%02d/%02d/%04d %02d:%02d:%02d", $v[5].$v[6], $v[8].$v[9], $v, $v[11].$v[12],$v[14].$v[15],$v[17].$v[18]); else $ret = sprintf("%02d/%02d/%04d %02d:%02d:%02d", $v[8].$v[9], $v[5].$v[6], $v, $v[11].$v[12],$v[14].$v[15],$v[17].$v[18]); return $ret; } function dateToMysql($date_cible) { global $l; if(!isset($date_cible)) return ""; $dateAr = explode("/", $date_cible); if( $l->g(269) == "%m/%d/%Y" ) { $jour = $dateAr[1]; $mois = $dateAr[0]; } else { $jour = $dateAr[0]; $mois = $dateAr[1]; } $annee = $dateAr[2]; return sprintf("%04d-%02d-%02d", $annee, $mois, $jour); } function getBrowser() { $bro = $_SERVER['HTTP_USER_AGENT']; if( strpos ( $bro, "MSIE") === false ) { return "MOZ"; } return "IE"; } function getBrowserLang() { $bro = $_SERVER['HTTP_ACCEPT_LANGUAGE']; if (strpos( $bro,"de") === false) { // Not german if (strpos( $bro,"es") === false) { // Not spanish if (strpos( $bro,"fr") === false) { // Not french if (strpos( $bro,"it") === false) { // Not italian if (strpos( $bro,"pt-br") === false) { // Not brazilian portugueuse if (strpos( $bro,"pt") === false) { // Not portugueuse if (strpos( $bro,"pl") === false) { // Not polish // Use english default language return "english"; } else // Polish return "polish"; } else // Portugueuse return "portugueuse"; } else // Brazilian portugueuse return "brazilian_portugueuse"; } else // Italian return "italian"; } else // French return "french"; } else // Spanish return "spanish"; } else // German return "german"; } function printNavigation( $lesGets, $numPages) { $prefG = ""; if( $numPages > 1 ) { if( $_SESSION["pageCur"] == 1) { echo "  ";//voir grisé echo "  1 .."; } else { echo "  {$prefG}-1>"; echo " {$prefG}1>1 .."; } if( $_SESSION["pageCur"] && $_SESSION["pageCur"]>1 && $_SESSION["pageCur"]!=$numPages ) { echo " ".$_SESSION["pageCur"]." "; } if( $_SESSION["pageCur"] >= $numPages) { echo "..  $numPages "; //echo "  "; voir grisé } else { echo ".. {$prefG}$numPages>$numPages "; echo "{$prefG}-2>  "; } } echo "


"; } function deleteNet($id) { mysql_query("DELETE FROM network_devices WHERE macaddr='$id';", $_SESSION["writeServer"]); } function deleteDid($id, $checkLock = true, $traceDel = true) { global $l; if( ! $checkLock || lock($id) ) { $resId = mysql_query("SELECT deviceid FROM hardware WHERE id='$id'",$_SESSION["readServer"]) or die(mysql_error()); $valId = mysql_fetch_array($resId); $idHard = $id; $did = $valId["deviceid"]; if( $idHard ) { if( strpos ( $did, "NETWORK_DEVICE-" ) === false ) { $resNetm = @mysql_query("SELECT macaddr FROM networks WHERE hardware_id=$idHard", $_SESSION["writeServer"]) or die(mysql_error()); while( $valNetm = mysql_fetch_array($resNetm)) { @mysql_query("DELETE FROM netmap WHERE mac='".$valNetm["macaddr"]."';", $_SESSION["writeServer"]) or die(mysql_error()); } } $tables=Array("accesslog","accountinfo","bios","controllers","drives", "inputs","memories","modems","monitors","networks","ports","printers","registry", "slots","softwares","sounds","storages","videos","devices"); echo "
$did ".$l->g(220)."
"; foreach ($tables as $table) { mysql_query("DELETE FROM $table WHERE hardware_id=$idHard;", $_SESSION["writeServer"]) or die(mysql_error()); } mysql_query("DELETE FROM hardware WHERE id=$idHard;", $_SESSION["writeServer"]) or die(mysql_error()); //TRACE_DELETED if($traceDel && mysql_num_rows(mysql_query("SELECT IVALUE FROM config WHERE IVALUE>0 AND NAME='TRACE_DELETED'", $_SESSION["writeServer"]))){ mysql_query("insert into deleted_equiv(DELETED,EQUIVALENT) values('$did',NULL)", $_SESSION["writeServer"]) or die(mysql_error()); } } if( $checkLock ) unlock($id); } else errlock(); } function lock($id) { //echo "
LOCK $id
"; $reqClean = "DELETE FROM locks WHERE unix_timestamp(since)<(unix_timestamp(NOW())-60)"; $resClean = mysql_query($reqClean, $_SESSION["writeServer"]) or die(mysql_error()); $reqLock = "INSERT INTO locks(hardware_id) VALUES ('$id')"; if( $resLock = mysql_query($reqLock, $_SESSION["writeServer"]) or die(mysql_error())) return( mysql_affected_rows ( $_SESSION["writeServer"] ) == 1 ); else return false; } function unlock($id) { //echo "
UNLOCK $id
"; $reqLock = "DELETE FROM locks WHERE hardware_id='$id'"; $resLock = mysql_query($reqLock, $_SESSION["writeServer"]) or die(mysql_error()); return( mysql_affected_rows ( $_SESSION["writeServer"] ) == 1 ); } function errlock() { global $l; echo "
".$l->g(376)."

"; } function incPicker() { global $l; echo " "; } ?>