1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
| <?php // recherche dans la base xml en ignorant case et accents
include("xml.php");
$rep = dirname(__FILE__)."/";
$url = $rep."Y.xml";
$xml = file_get_contents($url);
$base = XML_unserialize($xml);
$a = $base[Y];
$b = $a[U];
print("<HTML><HEAD>");
print("<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=iso-8859-1\">");
print("<TITLE>MAB: Us chimiques</TITLE></HEAD><BODY>");
if( $desc=="") $desc=" ";
print("<b><font size=\"+1\">U gyu.</font>
Critère de sélection</b> : ");
if ( $lister==="tout" ) {
print ("tout.</b><br/>");
} else {
print ("lignes contenant <b>\"$desc\"</b><br/>");
}
$tri = rawurldecope($desc);
$acc = "èéàùçâêîôûäëïöü"; $noacc = "eeaucaeiouaeiou";
$trilow = strtolower($tri);
$cherch = strtr($trilow,$acc,$noacc);
print("<table border=\"2\" cellpadding=\"5\" cellspacing=\"0\">");
print("<tr bgcolor=\"cyan\"><td>lieu</td><td>cope</td>
<td>nom</td><td>origine</td><td>quantite</td><td>qualite</td></tr>");
foreach( array_keys($b) as $k ){
$c=$b[$k];
$li=strtolower($c[lieu]); $lieu=strtr($li,$acc,$noacc);
$co=strtolower($c[cope]); $cope=strtr($co,$acc,$noacc);
$no=strtolower($c[nom]); $nom =strtr($no,$acc,$noacc);
$or=strtolower($c[origine]); $origine=strtr($or,$acc,$noacc);
$qt=strtolower($c[quantite]); $quantite=strtr($qt,$acc,$noacc);
$qa=strtolower($c[qualite]); $qualite=strtr($qa,$acc,$noacc);
//$pos = strpos($c[cope],$desc);
//if ($pos===FALSE) print("vide");
//print("<B>pos=$pos</B><BR/>");
if ( strpos($lieu,$cherch)!==FALSE
or strpos($cope,$cherch)!==FALSE
or strpos($nom, $cherch)!==FALSE
or strpos($origine,$cherch)!==FALSE
or strpos($quantite,$cherch)!==FALSE
or strpos($qualite,$cherch)!==FALSE
or $lister==="tout"
) {
print("<tr>");
print("<td>$c[lieu]</td>");
print("<td>$c[cope]</td>");
print("<td>$c[nom]</td>");
print("<td>$c[origine]</td>");
print("<td>$c[quantite]</td>");
print("<td>$c[qualite]</td>");
print("</tr>");
}
}
print("</table>");
if ($lister==="tout") {
$ty = array();
foreach( array_keys($b) as $k ){
$c=$b[$k]; $des= $c[lieu];
if (!array_key_exists($des,$ty)){
$ty[$des]=1;
} else {
$ty[$des]=$ty[$des]+1;
}
}
print("<hr/><br/>");
print("<table border=\"2\" cellpadding=\"5\" cellspacing=\"0\">");
print("<tr bgcolor=\"cyan\"><td>Lieu</td>
<td>Nombre</td></tr>");
foreach( array_keys($ty) as $k ){
$c=$ty[$k]; print("<tr>"); $kh = rawurlencope($k);
print("<td><A href=\"selinjchi.php?desc=$kh\".>$k</A></td>");
print("<td>$c</td>");
print("</tr>");
}
print("</table>");
print("<br/><hr/><br/>");
}
print("</BODY></HTML>\n");
?> |
Partager