J'ai un petit souci depuis la migration de mon site sous PHP5. J'ai un site dédié à des jeux de simulations de course. Sur une des pages, j'ai recensé et mis en téléchargement des réglages (setups) pour plusieurs voitures et circuits. Pour faciliter les recherches, ma page propose des flèches de tri... sauf que ces dernières ne fonctionnent plus.
De ce que j'ai pu comprendre, c'est lien au passage dans l'URL des variables de tri. Sous réserve que ça vienne bien de là, je n'ai pas réussi à trouver la solution et c'est là que j'en appelle à vos compétences. Merci d'avance
La page en question se trouve ICI et en voici le code :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.Style1 {font-family: Tahoma; font-size: x-small; font-weight: bold; color: #999999;}
.Style2 {font-family: Tahoma; font-size: large; font-weight: bold; color: #666666;}
.Style3 {font-family: Tahoma; font-size: x-small; font-weight: bold; color: #CC0000;}
a:link {
color: #999999;
text-decoration: none;
}
a:visited {
color: #999999;
text-decoration: none;
}
a:hover {
color: #07A9FA;
text-decoration: none;
}
a:active {
color: #999999;
text-decoration: none;
}
-->
</style>
</head>
<body>
<table width="600" align="center">
<tr>
<td align="center" width="25%" height="40"><img src="../ressources/circuit.png" width="125" height="35"><br>
<a href="gtr_setups.php?VARTri=0" target="GTR_Detail"><img src="../ressources/up.png" width="40" height="20" border="0"></a><a href="gtr_setups.php?VARTri=1" target="GTR_Detail"><img src="../ressources/down.png" width="40" height="20" border="0"></a></td>
<td align="center" width="25%" height="40"><img src="../ressources/chassis.png"><br>
<a href="gtr_setups.php?VARTri=2" target="GTR_Detail"><img src="../ressources/up.png" width="40" height="20" border="0"></a><a href="gtr_setups.php?VARTri=3" target="GTR_Detail"><img src="../ressources/down.png" width="40" height="20" border="0"></a></td>
<td align="center" width="25%" height="40"><img src="../ressources/chrono.png"><br>
<a href="gtr_setups.php?VARTri=4" target="GTR_Detail"><img src="../ressources/up.png" width="40" height="20" border="0"></a><a href="gtr_setups.php?VARTri=5" target="GTR_Detail"><img src="../ressources/down.png" width="40" height="20" border="0"></a></td>
<td align="center" width="25%" height="40"><img src="../ressources/date.png"><br>
<a href="gtr_setups.php?VARTri=6" target="GTR_Detail"><img src="../ressources/up.png" width="40" height="20" border="0"></a><a href="gtr_setups.php?VARTri=7" target="GTR_Detail"><img src="../ressources/down.png" width="40" height="20" border="0"></a></td>
</tr>
<tr>
<td align="center" colspan="4"><img src="../ressources/separation.png" width="560" height="1"></td>
</tr>
<?php
$v=array("BMW","F360","Vert","Elise","Morgan","Cup","GT3","Seat","C5R","Viper","F550","F575","Lambo","Lister","Mosler","Turbo","GT2","Saleen");
$w=array("BMW Z3","Ferrari F360","Gillet Vertigo","Lotus Elise","Morgan Aero 8","Porsche Cup","Porsche GT3 RS","Seat Toledo","Corvette C5R","Chrysler Viper","Ferrari F550","Ferrari F575","Lamborghini Murcielago","Lister Storm","Mosler MT900","Porsche Turbo","Porsche GT2","Saleen S7-R");
$c=array("Ander","Barce","Brno","Doni","Enna","Esto","Magny","Monza","Oscher","Spa");
$d=array("Anderstorp","Barcelone","Brno","Donington","Enna","Estoril","Magny","Monza","Oschersleben","Spa");
$compteur=0;
$circuit=array();
$voiture=array();
$chrono=array();
$date=array();
$fichier=array();
if ($handle = opendir('setups/'))
{while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$setup=explode("-",$file);
$setup[1]=str_replace($v,$w,$setup[1]);
$setup[2]=str_replace($c,$d,$setup[2]);
$setup[3]=substr($setup[3],0,1).':'.substr($setup[3],1,2).'.'.substr($setup[3],3,3);
array_push ($circuit, $setup[2]);
array_push ($voiture, $setup[1]);
array_push ($chrono, $setup[3]);
array_push ($date, filemtime('setups/'.$file));
array_push ($fichier, 'setups/'.$file);
}
} closedir($handle);
}
?>
<?php
$tableau = array('circuit'=>$circuit, 'voiture'=>$voiture, 'chrono'=>$chrono, 'date'=>$date, 'fichier'=>$fichier);
if ($_GET['VARTri']==0)
{array_multisort($circuit, SORT_ASC, $voiture, $chrono, $date, $fichier); }
else if ($_GET['VARTri']==1)
{array_multisort($circuit, SORT_DESC, $voiture, $chrono, $date, $fichier); }
else if ($_GET['VARTri']==2)
{array_multisort($voiture, SORT_ASC, $circuit, $chrono, $date, $fichier); }
else if ($_GET['VARTri']==3)
{array_multisort($voiture, SORT_DESC, $circuit, $chrono, $date, $fichier); }
else if ($_GET['VARTri']==4)
{array_multisort($chrono, SORT_ASC, $voiture, $circuit, $date, $fichier); }
else if ($_GET['VARTri']==5)
{array_multisort($chrono, SORT_DESC, $voiture, $circuit, $date, $fichier); }
else if ($_GET['VARTri']==6)
{array_multisort($date, SORT_ASC, $voiture, $circuit, $chrono, $fichier); }
else if ($_GET['VARTri']==7)
{array_multisort($date, SORT_DESC, $voiture, $circuit, $chrono, $fichier); }
?>
<?php
while ($compteur < count($date)) {
?>
<tr>
<td align="center" width='25%'><span class="Style1"><?php echo $tableau['circuit'][$compteur]; ?></span></td>
<td align="center" width='25%'><span class="Style1"><?php echo $tableau['voiture'][$compteur]; ?></span></td>
<td align="center" width='25%'><span class="Style1"><a href="<?php echo $tableau['fichier'][$compteur];?>"><?php echo $tableau['chrono'][$compteur]; ?></a></span></td>
<td align="center" width='25%'><span class="Style1"><?php echo date ("d/m/y",$tableau['date'][$compteur]); ?></span></td>
</tr>
<tr>
<td align="center" colspan="4"><img src="../ressources/separation.png" width="560" height="1"></td>
</tr>
<?php
$compteur++; }
?>
</table>
</body>
</html>