'raisonSociale', 'N' => 'numVoie', 'R' => 'voie', 'L' => 'cpVille', 'V' => 'cpVille'); $liste = file($fichierLog); if ($num != '') { $n = intval($num); $indices = array($n); } else { $n = ($page - 1) * $NB_PAR_PAGE; $indices = range($n, min($n + $NB_PAR_PAGE - 1, count($liste) - 1)); } foreach ($indices as $i) { $ligne = explode('#', $liste[$i], 2); ++$n; $formR = array(); $criteres = explode(',', $ligne[0]); unset($nb_rep); $siret = ''; // Nombre de resultats et siret foreach ($criteres as $c) { $labelvaleur = explode('=', $c); $label = trim($labelvaleur[0]); if ($label == 'NbRep' && isset($labelvaleur[1]) == true) { $nb_rep = intval(trim($labelvaleur[1])); } if ($label == 'SiretTrouve' && isset($labelvaleur[1]) == true) { $siret = trim($labelvaleur[1]); } } // Restrictions if (isset($nb_rep) == false || $nb_rep != 1 || $siret == '') { //continue; } // Criteres foreach ($criteres as $c) { $labelvaleur = explode('=', $c, 2); $label = trim($labelvaleur[0]); if (isset($labelvaleur[1]) == false) { continue; } $valeur = trim($labelvaleur[1]); if (isset($crit2form[$label]) == false) { continue; } if ($label == 'R' && preg_match('/[0-9]+/', $valeur, $arrayValeur) > 0) { $formR['numVoie'] = $arrayValeur[0]; $valeur = str_replace($arrayValeur[0].' ', '', $valeur); print 'N='.$arrayValeur[0].', '; } if (isset($formR[$crit2form[$label]]) == false) { $formR[$crit2form[$label]] = $valeur; } else { $formR[$crit2form[$label]] .= ' '.$valeur; } print $label.'='.$valeur.', '; } // Recherche $formR['type'] = 'ent'; $res = recherche($formR, 0, 100); $total = 0; $siren = 0; $nic = 0; $resSiret = '00000000000000'; if (isset($res['nbReponsesTotal'])) { $total = $res['nbReponsesTotal']; if ($total == 1) { $siren = $res['reponses'][0]['Siren']; $nic = $res['reponses'][0]['Nic']; $resSiret = sprintf("%09d%05d", $siren, $nic); } else if (isset($nb_rep) != false && ($nb_rep < $total) && ($nb_rep == 10 || $nb_rep == 20)) { $total = $nb_rep; } } if ($siret != '') { if ($siret != '00000000000000' && $siret != $resSiret) { print ''.$siret.' '; } else { print $siret.' '; } print $resSiret.' '; } if (($siret != '' && $siret != '00000000000000' && $siret != $resSiret) || (isset($nb_rep) != false && $nb_rep != 0 && $nb_rep != $total) || (isset($nb_rep) == false && $total == 0)) { print 'pass'.$res['pass'].' '; } else { print 'pass'.$res['pass'].' '; } if (isset($nb_rep) != false) { if ($nb_rep != 0 && $nb_rep != $total) { print ''.$nb_rep.' '; } else { print $nb_rep; } } print ' '. $total.''; if (count($ligne) == 2) { print ' #'.$ligne[1]; } print '
'; } if ($num == '') { print '
pages: '; for ($p = 1; $p < $page; ++$p) { print ''.$p.' '; } print ''.$page.' '; for ($p = $page + 1; ($p - 1) * $NB_PAR_PAGE < count($liste); ++$p) { print ''.$p.' '; } } } ?>