Suite à une migration vers un nouveau serveur avec nouvelle version de php
passage de php 4 vers php 5 je pense ma page ne s'affiche plus correctement le script n'est plus bon semble t'il.
La personne en charge du developpement est en congés maternité donc j'ai besoin d'aide
La page concernée effectue un affichage des produits par mois avec possibilité de passer au mois precedent ou suivant.
L'affichage devrait etre du type de la page suivante mais avec des mois à la place des semaines
http://www.video-futur.ch/index2.php?centre=s_semaine
Quelqu'un pourrait il me refaire le code de cette page?
la page qui ne fonctionne plus est :
http://www.video-futur.ch/index2.php?centre=s_mois
CODE SOURCE DE LA PAGE QUI NE FONCTIONNE PLUS:
<?PHP
//----------------------------------------------
// Verification que le fichier n'est pas appeler seul
if ( !defined('Video-FUTUR') ) die("Hacking attempt");
define('PAGE',"centre=s_mois");
//on verifie si la variable $decale_mois est definie, sinon on l'initialise à 0
if(!isset($_GET['decale_mois'])) $decale_mois = 0;
else $decale_mois = $_GET['decale_mois'];
$jour=date("d");
switch ($jour)
{
case "31" :
$day="-4 day";
break;
case "30" :
$day="-3 day";
break;
case "29" :
$day="-2 day";
break;
case "29" :
$day="-1 day";
break;
default :
$day="";
}
//on verifie si la variable $pg est definie, sinon on l'initialise a 1
if(!isset($_GET['pg'])) $pg = 1;
else $pg = $_GET['pg'];
//on verifie si la variable qui est censcée etre un numero de page est bien un chiffre,
//cela evite un piratage avec une injection mysql
if(!is_numeric($pg)) $pg = 1;
//calclue du mois precedent avec le decalage
$decale_mois_dernier = $decale_mois -1;
$le_mois_dernier_j1 = strftime ("%Y-%m-01", strtotime("$decale_mois_dernier month + $day"));
$le_mois_dernier_j31 = strftime ("%Y-%m-31", strtotime("$decale_mois_dernier month + $day"));
$Num_mois_dernier = strftime ("%m", strtotime("$decale_mois_dernier month + $day"));
$Num_annee_mois_dernier = strftime ("%Y", strtotime("$decale_mois_dernier month + $day"));
$Num_mois = strftime ("%m", strtotime("$decale_mois month + $day"));
$le_mois_j1 = strftime ("%Y-%m-01", strtotime("$decale_mois month + $day"));
$le_mois_j31 = strftime ("%Y-%m-31", strtotime("$decale_mois month + $day"));
//calclue du mois suivant avec le decalage
$decale_mois_suivant = $decale_mois +1;
$le_mois_suivant_j1 = strftime ("%Y-%m-01", strtotime("$decale_mois_suivant month + $day"));
$le_mois_suivant_j31 = strftime ("%Y-%m", strtotime("$decale_mois_suivant month + $day"));
$Num_mois_suivant = strftime ("%m", strtotime("$decale_mois_suivant month + $day"));
$Num_annee_mois_suivant = strftime ("%Y", strtotime("$decale_mois_suivant month + $day"));
//c'est le nb d'enregstrements à affiche par page:
if ($_SESSION[det_page]==0) $enreg_par_pg = enreg_par_pg_vignette;
else $enreg_par_pg = enreg_par_pg;
//ici on calcule à partir de quel enregistrement il faut afficher $enreg_par_pg résultats
$limit = $enreg_par_pg*$pg-$enreg_par_pg;
//c'est la requete qui selectione $enreg_par_pg resultats
$query = "SELECT DISTINCT (titre_film),`Z1`, `Z2_fr`, `Z2_su`, `Z2_it`, `Z2_de`, `Z2_au`, `blue_ray`, `hd_dvd`, `dvd` FROM film, genre WHERE film.num_genre = genre.num_genre ";
if (($_SESSION[Z1] == 1) && ($_SESSION[Z2] == 1) && ($_SESSION[blu_ray] == 1) && ($_SESSION[hd]==1) && ($_SESSION[dvd]==1))
{
$_SESSION[dvd] = $_SESSION[blu_ray] = $_SESSION[hd] = $_SESSION[Z1] = $_SESSION[Z2] = 0;
$_SESSION[ddvd] = $_SESSION[hhd] = $_SESSION[bbr] = $_SESSION[ZZ1] = $_SESSION[ZZ2] = 1;
}
if ($_SESSION[Z1] == 1) $query .=" AND film.Z1 != 1 ";
//if ($_SESSION[Z2] == 1) $query .=" AND film.Z2_fr != 1 AND film.Z2_su != 1 AND film.Z2_it != 1 AND film.Z2_de != 1 AND film.Z2_au != 1";
if ($_SESSION[Z2] == 1) $query .="AND film.Z1 = 1 ";
if ($_SESSION[DvDX] == 0) $query .=" AND genre.genre_genre != 'X' ";
if ($_SESSION[blu_ray]== 1)
{
$query .=" AND film.blue_ray != 1 ";
}
if ($_SESSION[hd]== 1)
{
$query .=" AND film.hd_dvd != 1 ";
}
if ($_SESSION[dvd]== 1)
{
$query .=" AND film.dvd != 1 ";
}
$query .="AND film.etat_film != 'Pas en loc'";
$query .=" AND date_achat_film BETWEEN '$le_mois_j1' AND '$le_mois_j31' ORDER BY film.date_achat_film ASC";
//echo $query;
$query1=$query." LIMIT $limit, $enreg_par_pg";
$req = mysql_query($query1)or die("Erreur MySQL: ".mysql_error($connect)."<br>".$query1);
/*********************************** Corps de la page *******************************************************************************************/
$num_mois = mois($Num_mois);
?>
<TABLE style="HEIGHT: 34px" cellSpacing=0 cellPadding=5 width=100% align=center bgColor=<? echo Color_Trad ?> border=0>
<TR bgColor=<? echo Color_Trad ?>>
<TD rowspan="2" width="150">
<DIV align=left><FONT color=#ffffff><b><?echo $lang['titre_Smois'];?>
<?
echo ucfirst(mois($Num_mois));
//echo $Num_mois;
?>
</DIV></b>
</TD>
<td align="center">
<?
echo '<FONT COLOR="#FFFFFF" size=2>Support : </font>';
echo '<FONT COLOR="#FFFFFF" size=1><input type="checkbox" name="DVD"';
if ($_SESSION[dvd] == "0" || !isset($_SESSION[dvd]))
{
$add=$_SERVER['REQUEST_URI'];
if ($_SESSION[ddvd] =="1")
{
if (strstr($add, '?Z1=1')) $add=str_replace("?Z1=1","",$add);
if (strstr($add, '&Z1=1')) $add=str_replace("&Z1=1","",$add);
if (strstr($add, '?Z2=1')) $add=str_replace("?Z2=1","",$add);
if (strstr($add, '&Z2=1')) $add=str_replace("&Z2=1","",$add);
if (strstr($add, '?blu_ray=1')) $add=str_replace("?blu_ray=1","",$add);
if (strstr($add, '&blu_ray=1')) $add=str_replace("&blu_ray=1","",$add);
if (strstr($add, '?hd=1')) $add=str_replace("?hd=1","",$add);
if (strstr($add, '&hd=1')) $add=str_replace("&hd=1","",$add);
if (strstr($add, '?dvd=1')) $add=str_replace("?dvd=1","",$add);
if (strstr($add, '&dvd=1')) $add=str_replace("&dvd=1","",$add);
$_SESSION[ddvd]="0";
}
if (strstr($add, '?')) $add2="&";
else $add2="?";
// if (strstr($add, 'Z2=1')) $add=str_replace("Z2=1","Z2=0",$add);
if (strstr($add, 'dvd=0')) $add=str_replace("dvd=0","dvd=1",$add);
else $add=$add."".$add2."dvd=1";
echo "onClick=\"window.location.replace('$add')\"";
echo " checked>";
}
else
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'dvd=1')) $add=str_replace("dvd=1","dvd=0",$add);
else $add=$add."".$add2."dvd=0";
echo " onClick=\"window.location.replace('$add')\">";
}
echo " DVD</font>";
echo '<FONT COLOR="#FFFFFF" size=1><input type="checkbox" name="blue_ray"';
if ($_SESSION[blu_ray] == "0" || !isset($_SESSION[blu_ray]))
{
$add=$_SERVER['REQUEST_URI'];
if ($_SESSION[bbr] =="1")
{
if (strstr($add, '?Z1=1')) $add=str_replace("?Z1=1","",$add);
if (strstr($add, '&Z1=1')) $add=str_replace("&Z1=1","",$add);
if (strstr($add, '?Z2=1')) $add=str_replace("?Z2=1","",$add);
if (strstr($add, '&Z2=1')) $add=str_replace("&Z2=1","",$add);
if (strstr($add, '?blu_ray=1')) $add=str_replace("?blu_ray=1","",$add);
if (strstr($add, '&blu_ray=1')) $add=str_replace("&blu_ray=1","",$add);
if (strstr($add, '?hd=1')) $add=str_replace("?hd=1","",$add);
if (strstr($add, '&hd=1')) $add=str_replace("&hd=1","",$add);
if (strstr($add, '?dvd=1')) $add=str_replace("?dvd=1","",$add);
if (strstr($add, '&dvd=1')) $add=str_replace("&dvd=1","",$add);
$_SESSION[bbr]="0";
}
if (strstr($add, '?')) $add2="&";
else $add2="?";
// if (strstr($add, 'Z2=1')) $add=str_replace("Z2=1","Z2=0",$add);
if (strstr($add, 'blu_ray=0')) $add=str_replace("blu_ray=0","blu_ray=1",$add);
else $add=$add."".$add2."blu_ray=1";
echo "onClick=\"window.location.replace('$add')\"";
echo " checked>";
}
else
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'blu_ray=1')) $add=str_replace("blu_ray=1","blu_ray=0",$add);
else $add=$add."".$add2."blu_ray=0";
echo " onClick=\"window.location.replace('$add')\">";
}
echo " Blu ray</font>";
echo '<FONT COLOR="#FFFFFF" size=1><input type="checkbox" name="hd_dvd"';
if ($_SESSION[hd] == "0" || !isset($_SESSION[hd]))
{
$add=$_SERVER['REQUEST_URI'];
if ($_SESSION[hhd] =="1")
{
if (strstr($add, '?Z1=1')) $add=str_replace("?Z1=1","",$add);
if (strstr($add, '&Z1=1')) $add=str_replace("&Z1=1","",$add);
if (strstr($add, '?Z2=1')) $add=str_replace("?Z2=1","",$add);
if (strstr($add, '&Z2=1')) $add=str_replace("&Z2=1","",$add);
if (strstr($add, '?blu_ray=1')) $add=str_replace("?blu_ray=1","",$add);
if (strstr($add, '&blu_ray=1')) $add=str_replace("&blu_ray=1","",$add);
if (strstr($add, '?hd=1')) $add=str_replace("?hd=1","",$add);
if (strstr($add, '&hd=1')) $add=str_replace("&hd=1","",$add);
if (strstr($add, '?dvd=1')) $add=str_replace("?dvd=1","",$add);
if (strstr($add, '&dvd=1')) $add=str_replace("&dvd=1","",$add);
$_SESSION[hhd]="0";
}
if (strstr($add, '?')) $add2="&";
else $add2="?";
// if (strstr($add, 'Z2=1')) $add=str_replace("Z2=1","Z2=0",$add);
if (strstr($add, 'hd=0')) $add=str_replace("hd=0","hd=1",$add);
else $add=$add."".$add2."hd=1";
echo "onClick=\"window.location.replace('$add')\"";
echo " checked>";
}
else
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'hd=1')) $add=str_replace("hd=1","hd=0",$add);
else $add=$add."".$add2."hd=0";
echo " onClick=\"window.location.replace('$add')\">";
}
echo " HD DVD</font>";
//echo '<p align="center"><FONT COLOR="#FFFFFF" size=1><INPUT TYPE="checkbox" NAME="Z1" value="oui"';
echo'</td></tr><tr><td align="center"><FONT COLOR="#FFFFFF" size=2>Zone : </font><FONT COLOR="#FFFFFF" size=1><input type="checkbox" name="Zone1"';
if ($_SESSION[Z1] == "0" || !isset($_SESSION[Z1]))
{
$add=$_SERVER['REQUEST_URI'];
if ($_SESSION[ZZ1] =="1")
{
if (strstr($add, '?Z1=1')) $add=str_replace("?Z1=1","",$add);
if (strstr($add, '&Z1=1')) $add=str_replace("&Z1=1","",$add);
if (strstr($add, '?Z2=1')) $add=str_replace("?Z2=1","",$add);
if (strstr($add, '&Z2=1')) $add=str_replace("&Z2=1","",$add);
if (strstr($add, '?blu_ray=1')) $add=str_replace("?blu_ray=1","",$add);
if (strstr($add, '&blu_ray=1')) $add=str_replace("&blu_ray=1","",$add);
if (strstr($add, '?hd=1')) $add=str_replace("?hd=1","",$add);
if (strstr($add, '&hd=1')) $add=str_replace("&hd=1","",$add);
if (strstr($add, '?dvd=1')) $add=str_replace("?dvd=1","",$add);
if (strstr($add, '&dvd=1')) $add=str_replace("&dvd=1","",$add);
$_SESSION[ZZ1]="0";
}
if (strstr($add, '?')) $add2="&";
else $add2="?";
// if (strstr($add, 'Z2=1')) $add=str_replace("Z2=1","Z2=0",$add);
if (strstr($add, 'Z1=0')) $add=str_replace("Z1=0","Z1=1",$add);
else $add=$add."".$add2."Z1=1";
echo "onClick=\"window.location.replace('$add')\"";
echo " checked>";
}
else
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'Z1=1')) $add=str_replace("Z1=1","Z1=0",$add);
else $add=$add."".$add2."Z1=0";
echo " onClick=\"window.location.replace('$add')\">";
}
echo " Z1</font>";
//echo ' <FONT COLOR="#FFFFFF" size=1><INPUT TYPE="checkbox" NAME="Z2" value="oui"';
echo ' <FONT COLOR="#FFFFFF" size=1><input type="checkbox" value="2" name="Zone"';
if ($_SESSION[Z2] == "0" || !isset($_SESSION[Z2]))
{
$add=$_SERVER['REQUEST_URI'];
if ($_SESSION[ZZ2] =="1")
{
if (strstr($add, '?Z1=1')) $add=str_replace("?Z1=1","",$add);
if (strstr($add, '&Z1=1')) $add=str_replace("&Z1=1","",$add);
if (strstr($add, '?Z2=1')) $add=str_replace("?Z2=1","",$add);
if (strstr($add, '&Z2=1')) $add=str_replace("&Z2=1","",$add);
if (strstr($add, '?blu_ray=1')) $add=str_replace("?blu_ray=1","",$add);
if (strstr($add, '&blu_ray=1')) $add=str_replace("&blu_ray=1","",$add);
if (strstr($add, '?hd=1')) $add=str_replace("?hd=1","",$add);
if (strstr($add, '&hd=1')) $add=str_replace("&hd=1","",$add);
if (strstr($add, '?dvd=1')) $add=str_replace("?dvd=1","",$add);
if (strstr($add, '&dvd=1')) $add=str_replace("&dvd=1","",$add);
$_SESSION[ZZ2]="0";
}
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'Z2=0')) $add=str_replace("Z2=0","Z2=1",$add);
else $add=$add."".$add2."Z2=1";
echo "onClick=\"window.location.replace('$add')\"";
echo " checked>";
}
else
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'Z2=1')) $add=str_replace("Z2=1","Z2=0",$add);
else $add=$add."".$add2."Z2=0";
echo " onClick=\"window.location.replace('$add')\">";
}
echo " Z2</font>";
?>
</td>
<TD>
<?
// echo "<CENTER><img name='Titre border='0' src='./img/titre/titre_sortie_mois_".$Num_mois.".jpg' width='250'></CENTER><br>\n";
echo '<p align="right"><FONT COLOR="#FFFFFF" size=2><INPUT TYPE="checkbox" NAME="affichage" value="oui"';
if ($_SESSION[det_page] == "1")
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'det_page=1'))
$add=str_replace("det_page=1","det_page=0",$add);
else $add=$add."".$add2."det_page=0";
echo "checked onClick=\"window.location.replace('$add')\">";
}
else
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'det_page=0'))
$add=str_replace("det_page=0","det_page=1",$add);
else $add=$add."".$add2."det_page=1";
echo " onClick=\"window.location.replace('$add')\">";
}
echo $lang['aff_det']."</font>";
?>
</td>
</tr></TR>
</TABLE>
<?PHP
// echo "<CENTER><img name='Titre border='0' src='./img/titre/titre_sortie_mois_".$Num_mois.".jpg'></CENTER>\n";
echo "<hr width='600' color='".Color_Trad."'>\n";
echo "<table border='0' width='100%'>\n";
echo "<tr>\n";
$num_mois = mois($Num_mois_dernier);
echo "<td width=10%><a href=?".PAGE."&decale_mois=$decale_mois_dernier><img src='".$racine."img/menu/bas_page/precedente.gif' width='58' height='48' border='0'></a></td><td width=20% nowrap><a href=?".PAGE."&decale_mois=$decale_mois_dernier>".$lang['titre_Smois']."$num_mois $Num_annee_mois_dernier</a></td>\n";
echo "<td width=40%>\n";
echo " ";
echo "</td>\n";
echo "<td width=20% nowrap>\n";
$num_mois = mois($Num_mois_suivant);
echo "<p align='right'><a href='?".PAGE."&decale_mois=$decale_mois_suivant'>".$lang['titre_Smois']."$num_mois $Num_annee_mois_suivant</a></td><td width=10%><a href='?".PAGE."&decale_mois=$decale_mois_suivant'><img src='".$racine."img/menu/bas_page/suivante.gif' width='58' height='48' border='0'></a></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<hr width='600' color='".Color_Trad."'>\n";
if ($_SESSION[det_page]==0)
{
echo "<table width='600' cellpadding='0' cellspacing='0'>\n";
echo "<tr width='550'><td align='center' >\n";
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>';}
//
//ici c le code qui affiche les resultas de votre requete, tout depend du script
//par exemple:
while($tab = mysql_fetch_assoc($req)){
// remplacement du carracter ' par \' pour la requette SQL
$titre_sql = addslashes ($tab['titre_film']);
$query_info_film="SELECT * FROM film WHERE titre_film='".$titre_sql."' AND Z1='".$tab['Z1']."' AND Z2_fr='".$tab['Z2_fr']."' AND Z2_su='".$tab['Z2_su']."' AND Z2_it='".$tab['Z2_it']."' AND Z2_de='".$tab['Z2_de']."' AND Z2_au='".$tab['Z2_au']."' AND blue_ray='".$tab['blue_ray']."' AND hd_dvd='".$tab['hd_dvd']."' AND dvd='".$tab['dvd']."'";
$result_info_film=mysql_query($query_info_film);
$info_film=mysql_fetch_array($result_info_film);
if ($info_film['Z1'] == 1) $zone = "1";
if ($info_film['Z2_fr'] == 1) $zone = "2";
if ($info_film['Z2_su'] == 1) $zone = "2 Ch";
if ($info_film['Z2_it'] == 1) $zone = "2 It";
if ($info_film['Z2_de'] == 1) $zone = "2 De";
if ($info_film['Z2_au'] == 1) $zone = "2";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// affichage des page par images
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($_SESSION[det_page]==0)
{
if ($i==Nbr_vignette)
{
echo "</tr></table><hr width='600' color='".Color_Trad."'>";
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>';
$i=0;
}
//image du film
echo '<td align="center"><div =align="center"><table><tr><td>';
echo "<CENTER><b><font size='1'>".$lang['Zone'];
echo "$zone </b></font></CENTER></td></tr>";
if($info_film[blue_ray]=="1")
{
echo "<tr><td align='center'><img src='http://".$_SERVER[HTTP_HOST]."/img/logo_blu_ray.gif' border='0' alt='blu ray'></td></tr><tr><td>";
}
else if($info_film[hd_dvd]=="1")
{
echo "<tr><td align='center'><img src='http://".$_SERVER[HTTP_HOST]."/img/logo_hd.gif' border='0' alt='hd dvd'></td></tr><tr><td>";
}
else
{
echo "<tr><td align='center'><img src='http://".$_SERVER[HTTP_HOST]."/img/logo_dvd.gif' border='0' alt='dvd'></td></tr><tr><td>";
}
echo '<a href="?centre=fiche&fiche='.$info_film[num_film].'">';
echo '<a href="?centre=fiche&fiche='.$info_film[num_film].'">';
//echo '<CENTER><img src="tag2.php?num_film='.$info_film[num_film].'&login='.$login.'" height="140" border="0" alt="'.$info_film['titre_film'].'"></CENTER>';
/*
$qte_cde=func_info_film($info_film[num_film],$login);
if (!empty($qte_cde)) $qte_cde=$info_film['titre_film']." / Qte cmd : ".$qte_cde;
else $qte_cde=$info_film['titre_film'];
echo '<CENTER><img src="tag2.php?num_film='.$info_film[num_film].'&login='.$login.'" height="140" border="0" alt="'.$qte_cde.'"></CENTER>';
*/
$filename=$racine.$info_film[image_film];
if (file_exists($filename))
echo '<center><img src="http://'.$_SERVER[HTTP_HOST].'/'.$info_film[image_film].'" height="140" border="0" alt="'.$info_film[titre_film].'"></CENTER>';
else echo '<center><img src="http://'.$_SERVER[HTTP_HOST].'/img/films/visu.jpg" height="140" border="0" alt="'.$info_film[titre_film].'"></CENTER>';
echo "</CENTER></a></td></tr><tr><td>";
echo '<a href="?centre=fiche&fiche='.$info_film[num_film].'">';
if (strlen($info_film['titre_film'])>nbr_titre) $titre_film = mb_strimwidth($info_film['titre_film'], 0, nbr_titre+4, " ...");
else $titre_film = $info_film['titre_film'];
echo "<font size='1'><b><CENTER>".$titre_film."</CENTER></b></font></a></td></tr></table></td>\n";
$i++;
}
else
{
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// AFFICHAGE DETAILLER
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
include ('Affichage_detail.php');
}
}
/************************************************************************************************************************************************/
//on appele la fonction précédament créée pour afficher les liens vers les autres pages, vous pouvez l'appeler plusieurs fois s'il le faut
if ($_SESSION[det_page]==0)
echo "</tr></table></table>";//<hr width='600' color='FF0000'>";
else echo "<br>";
echo "<hr width='600' color='3333CC'>";
pgs($enreg_par_pg, $pg, $connect,$query,PAGE."&decale_mois",$decale_mois);
?>
passage de php 4 vers php 5 je pense ma page ne s'affiche plus correctement le script n'est plus bon semble t'il.
La personne en charge du developpement est en congés maternité donc j'ai besoin d'aide
La page concernée effectue un affichage des produits par mois avec possibilité de passer au mois precedent ou suivant.
L'affichage devrait etre du type de la page suivante mais avec des mois à la place des semaines
http://www.video-futur.ch/index2.php?centre=s_semaine
Quelqu'un pourrait il me refaire le code de cette page?
la page qui ne fonctionne plus est :
http://www.video-futur.ch/index2.php?centre=s_mois
CODE SOURCE DE LA PAGE QUI NE FONCTIONNE PLUS:
<?PHP
//----------------------------------------------
// Verification que le fichier n'est pas appeler seul
if ( !defined('Video-FUTUR') ) die("Hacking attempt");
define('PAGE',"centre=s_mois");
//on verifie si la variable $decale_mois est definie, sinon on l'initialise à 0
if(!isset($_GET['decale_mois'])) $decale_mois = 0;
else $decale_mois = $_GET['decale_mois'];
$jour=date("d");
switch ($jour)
{
case "31" :
$day="-4 day";
break;
case "30" :
$day="-3 day";
break;
case "29" :
$day="-2 day";
break;
case "29" :
$day="-1 day";
break;
default :
$day="";
}
//on verifie si la variable $pg est definie, sinon on l'initialise a 1
if(!isset($_GET['pg'])) $pg = 1;
else $pg = $_GET['pg'];
//on verifie si la variable qui est censcée etre un numero de page est bien un chiffre,
//cela evite un piratage avec une injection mysql
if(!is_numeric($pg)) $pg = 1;
//calclue du mois precedent avec le decalage
$decale_mois_dernier = $decale_mois -1;
$le_mois_dernier_j1 = strftime ("%Y-%m-01", strtotime("$decale_mois_dernier month + $day"));
$le_mois_dernier_j31 = strftime ("%Y-%m-31", strtotime("$decale_mois_dernier month + $day"));
$Num_mois_dernier = strftime ("%m", strtotime("$decale_mois_dernier month + $day"));
$Num_annee_mois_dernier = strftime ("%Y", strtotime("$decale_mois_dernier month + $day"));
$Num_mois = strftime ("%m", strtotime("$decale_mois month + $day"));
$le_mois_j1 = strftime ("%Y-%m-01", strtotime("$decale_mois month + $day"));
$le_mois_j31 = strftime ("%Y-%m-31", strtotime("$decale_mois month + $day"));
//calclue du mois suivant avec le decalage
$decale_mois_suivant = $decale_mois +1;
$le_mois_suivant_j1 = strftime ("%Y-%m-01", strtotime("$decale_mois_suivant month + $day"));
$le_mois_suivant_j31 = strftime ("%Y-%m", strtotime("$decale_mois_suivant month + $day"));
$Num_mois_suivant = strftime ("%m", strtotime("$decale_mois_suivant month + $day"));
$Num_annee_mois_suivant = strftime ("%Y", strtotime("$decale_mois_suivant month + $day"));
//c'est le nb d'enregstrements à affiche par page:
if ($_SESSION[det_page]==0) $enreg_par_pg = enreg_par_pg_vignette;
else $enreg_par_pg = enreg_par_pg;
//ici on calcule à partir de quel enregistrement il faut afficher $enreg_par_pg résultats
$limit = $enreg_par_pg*$pg-$enreg_par_pg;
//c'est la requete qui selectione $enreg_par_pg resultats
$query = "SELECT DISTINCT (titre_film),`Z1`, `Z2_fr`, `Z2_su`, `Z2_it`, `Z2_de`, `Z2_au`, `blue_ray`, `hd_dvd`, `dvd` FROM film, genre WHERE film.num_genre = genre.num_genre ";
if (($_SESSION[Z1] == 1) && ($_SESSION[Z2] == 1) && ($_SESSION[blu_ray] == 1) && ($_SESSION[hd]==1) && ($_SESSION[dvd]==1))
{
$_SESSION[dvd] = $_SESSION[blu_ray] = $_SESSION[hd] = $_SESSION[Z1] = $_SESSION[Z2] = 0;
$_SESSION[ddvd] = $_SESSION[hhd] = $_SESSION[bbr] = $_SESSION[ZZ1] = $_SESSION[ZZ2] = 1;
}
if ($_SESSION[Z1] == 1) $query .=" AND film.Z1 != 1 ";
//if ($_SESSION[Z2] == 1) $query .=" AND film.Z2_fr != 1 AND film.Z2_su != 1 AND film.Z2_it != 1 AND film.Z2_de != 1 AND film.Z2_au != 1";
if ($_SESSION[Z2] == 1) $query .="AND film.Z1 = 1 ";
if ($_SESSION[DvDX] == 0) $query .=" AND genre.genre_genre != 'X' ";
if ($_SESSION[blu_ray]== 1)
{
$query .=" AND film.blue_ray != 1 ";
}
if ($_SESSION[hd]== 1)
{
$query .=" AND film.hd_dvd != 1 ";
}
if ($_SESSION[dvd]== 1)
{
$query .=" AND film.dvd != 1 ";
}
$query .="AND film.etat_film != 'Pas en loc'";
$query .=" AND date_achat_film BETWEEN '$le_mois_j1' AND '$le_mois_j31' ORDER BY film.date_achat_film ASC";
//echo $query;
$query1=$query." LIMIT $limit, $enreg_par_pg";
$req = mysql_query($query1)or die("Erreur MySQL: ".mysql_error($connect)."<br>".$query1);
/*********************************** Corps de la page *******************************************************************************************/
$num_mois = mois($Num_mois);
?>
<TABLE style="HEIGHT: 34px" cellSpacing=0 cellPadding=5 width=100% align=center bgColor=<? echo Color_Trad ?> border=0>
<TR bgColor=<? echo Color_Trad ?>>
<TD rowspan="2" width="150">
<DIV align=left><FONT color=#ffffff><b><?echo $lang['titre_Smois'];?>
<?
echo ucfirst(mois($Num_mois));
//echo $Num_mois;
?>
</DIV></b>
</TD>
<td align="center">
<?
echo '<FONT COLOR="#FFFFFF" size=2>Support : </font>';
echo '<FONT COLOR="#FFFFFF" size=1><input type="checkbox" name="DVD"';
if ($_SESSION[dvd] == "0" || !isset($_SESSION[dvd]))
{
$add=$_SERVER['REQUEST_URI'];
if ($_SESSION[ddvd] =="1")
{
if (strstr($add, '?Z1=1')) $add=str_replace("?Z1=1","",$add);
if (strstr($add, '&Z1=1')) $add=str_replace("&Z1=1","",$add);
if (strstr($add, '?Z2=1')) $add=str_replace("?Z2=1","",$add);
if (strstr($add, '&Z2=1')) $add=str_replace("&Z2=1","",$add);
if (strstr($add, '?blu_ray=1')) $add=str_replace("?blu_ray=1","",$add);
if (strstr($add, '&blu_ray=1')) $add=str_replace("&blu_ray=1","",$add);
if (strstr($add, '?hd=1')) $add=str_replace("?hd=1","",$add);
if (strstr($add, '&hd=1')) $add=str_replace("&hd=1","",$add);
if (strstr($add, '?dvd=1')) $add=str_replace("?dvd=1","",$add);
if (strstr($add, '&dvd=1')) $add=str_replace("&dvd=1","",$add);
$_SESSION[ddvd]="0";
}
if (strstr($add, '?')) $add2="&";
else $add2="?";
// if (strstr($add, 'Z2=1')) $add=str_replace("Z2=1","Z2=0",$add);
if (strstr($add, 'dvd=0')) $add=str_replace("dvd=0","dvd=1",$add);
else $add=$add."".$add2."dvd=1";
echo "onClick=\"window.location.replace('$add')\"";
echo " checked>";
}
else
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'dvd=1')) $add=str_replace("dvd=1","dvd=0",$add);
else $add=$add."".$add2."dvd=0";
echo " onClick=\"window.location.replace('$add')\">";
}
echo " DVD</font>";
echo '<FONT COLOR="#FFFFFF" size=1><input type="checkbox" name="blue_ray"';
if ($_SESSION[blu_ray] == "0" || !isset($_SESSION[blu_ray]))
{
$add=$_SERVER['REQUEST_URI'];
if ($_SESSION[bbr] =="1")
{
if (strstr($add, '?Z1=1')) $add=str_replace("?Z1=1","",$add);
if (strstr($add, '&Z1=1')) $add=str_replace("&Z1=1","",$add);
if (strstr($add, '?Z2=1')) $add=str_replace("?Z2=1","",$add);
if (strstr($add, '&Z2=1')) $add=str_replace("&Z2=1","",$add);
if (strstr($add, '?blu_ray=1')) $add=str_replace("?blu_ray=1","",$add);
if (strstr($add, '&blu_ray=1')) $add=str_replace("&blu_ray=1","",$add);
if (strstr($add, '?hd=1')) $add=str_replace("?hd=1","",$add);
if (strstr($add, '&hd=1')) $add=str_replace("&hd=1","",$add);
if (strstr($add, '?dvd=1')) $add=str_replace("?dvd=1","",$add);
if (strstr($add, '&dvd=1')) $add=str_replace("&dvd=1","",$add);
$_SESSION[bbr]="0";
}
if (strstr($add, '?')) $add2="&";
else $add2="?";
// if (strstr($add, 'Z2=1')) $add=str_replace("Z2=1","Z2=0",$add);
if (strstr($add, 'blu_ray=0')) $add=str_replace("blu_ray=0","blu_ray=1",$add);
else $add=$add."".$add2."blu_ray=1";
echo "onClick=\"window.location.replace('$add')\"";
echo " checked>";
}
else
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'blu_ray=1')) $add=str_replace("blu_ray=1","blu_ray=0",$add);
else $add=$add."".$add2."blu_ray=0";
echo " onClick=\"window.location.replace('$add')\">";
}
echo " Blu ray</font>";
echo '<FONT COLOR="#FFFFFF" size=1><input type="checkbox" name="hd_dvd"';
if ($_SESSION[hd] == "0" || !isset($_SESSION[hd]))
{
$add=$_SERVER['REQUEST_URI'];
if ($_SESSION[hhd] =="1")
{
if (strstr($add, '?Z1=1')) $add=str_replace("?Z1=1","",$add);
if (strstr($add, '&Z1=1')) $add=str_replace("&Z1=1","",$add);
if (strstr($add, '?Z2=1')) $add=str_replace("?Z2=1","",$add);
if (strstr($add, '&Z2=1')) $add=str_replace("&Z2=1","",$add);
if (strstr($add, '?blu_ray=1')) $add=str_replace("?blu_ray=1","",$add);
if (strstr($add, '&blu_ray=1')) $add=str_replace("&blu_ray=1","",$add);
if (strstr($add, '?hd=1')) $add=str_replace("?hd=1","",$add);
if (strstr($add, '&hd=1')) $add=str_replace("&hd=1","",$add);
if (strstr($add, '?dvd=1')) $add=str_replace("?dvd=1","",$add);
if (strstr($add, '&dvd=1')) $add=str_replace("&dvd=1","",$add);
$_SESSION[hhd]="0";
}
if (strstr($add, '?')) $add2="&";
else $add2="?";
// if (strstr($add, 'Z2=1')) $add=str_replace("Z2=1","Z2=0",$add);
if (strstr($add, 'hd=0')) $add=str_replace("hd=0","hd=1",$add);
else $add=$add."".$add2."hd=1";
echo "onClick=\"window.location.replace('$add')\"";
echo " checked>";
}
else
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'hd=1')) $add=str_replace("hd=1","hd=0",$add);
else $add=$add."".$add2."hd=0";
echo " onClick=\"window.location.replace('$add')\">";
}
echo " HD DVD</font>";
//echo '<p align="center"><FONT COLOR="#FFFFFF" size=1><INPUT TYPE="checkbox" NAME="Z1" value="oui"';
echo'</td></tr><tr><td align="center"><FONT COLOR="#FFFFFF" size=2>Zone : </font><FONT COLOR="#FFFFFF" size=1><input type="checkbox" name="Zone1"';
if ($_SESSION[Z1] == "0" || !isset($_SESSION[Z1]))
{
$add=$_SERVER['REQUEST_URI'];
if ($_SESSION[ZZ1] =="1")
{
if (strstr($add, '?Z1=1')) $add=str_replace("?Z1=1","",$add);
if (strstr($add, '&Z1=1')) $add=str_replace("&Z1=1","",$add);
if (strstr($add, '?Z2=1')) $add=str_replace("?Z2=1","",$add);
if (strstr($add, '&Z2=1')) $add=str_replace("&Z2=1","",$add);
if (strstr($add, '?blu_ray=1')) $add=str_replace("?blu_ray=1","",$add);
if (strstr($add, '&blu_ray=1')) $add=str_replace("&blu_ray=1","",$add);
if (strstr($add, '?hd=1')) $add=str_replace("?hd=1","",$add);
if (strstr($add, '&hd=1')) $add=str_replace("&hd=1","",$add);
if (strstr($add, '?dvd=1')) $add=str_replace("?dvd=1","",$add);
if (strstr($add, '&dvd=1')) $add=str_replace("&dvd=1","",$add);
$_SESSION[ZZ1]="0";
}
if (strstr($add, '?')) $add2="&";
else $add2="?";
// if (strstr($add, 'Z2=1')) $add=str_replace("Z2=1","Z2=0",$add);
if (strstr($add, 'Z1=0')) $add=str_replace("Z1=0","Z1=1",$add);
else $add=$add."".$add2."Z1=1";
echo "onClick=\"window.location.replace('$add')\"";
echo " checked>";
}
else
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'Z1=1')) $add=str_replace("Z1=1","Z1=0",$add);
else $add=$add."".$add2."Z1=0";
echo " onClick=\"window.location.replace('$add')\">";
}
echo " Z1</font>";
//echo ' <FONT COLOR="#FFFFFF" size=1><INPUT TYPE="checkbox" NAME="Z2" value="oui"';
echo ' <FONT COLOR="#FFFFFF" size=1><input type="checkbox" value="2" name="Zone"';
if ($_SESSION[Z2] == "0" || !isset($_SESSION[Z2]))
{
$add=$_SERVER['REQUEST_URI'];
if ($_SESSION[ZZ2] =="1")
{
if (strstr($add, '?Z1=1')) $add=str_replace("?Z1=1","",$add);
if (strstr($add, '&Z1=1')) $add=str_replace("&Z1=1","",$add);
if (strstr($add, '?Z2=1')) $add=str_replace("?Z2=1","",$add);
if (strstr($add, '&Z2=1')) $add=str_replace("&Z2=1","",$add);
if (strstr($add, '?blu_ray=1')) $add=str_replace("?blu_ray=1","",$add);
if (strstr($add, '&blu_ray=1')) $add=str_replace("&blu_ray=1","",$add);
if (strstr($add, '?hd=1')) $add=str_replace("?hd=1","",$add);
if (strstr($add, '&hd=1')) $add=str_replace("&hd=1","",$add);
if (strstr($add, '?dvd=1')) $add=str_replace("?dvd=1","",$add);
if (strstr($add, '&dvd=1')) $add=str_replace("&dvd=1","",$add);
$_SESSION[ZZ2]="0";
}
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'Z2=0')) $add=str_replace("Z2=0","Z2=1",$add);
else $add=$add."".$add2."Z2=1";
echo "onClick=\"window.location.replace('$add')\"";
echo " checked>";
}
else
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'Z2=1')) $add=str_replace("Z2=1","Z2=0",$add);
else $add=$add."".$add2."Z2=0";
echo " onClick=\"window.location.replace('$add')\">";
}
echo " Z2</font>";
?>
</td>
<TD>
<?
// echo "<CENTER><img name='Titre border='0' src='./img/titre/titre_sortie_mois_".$Num_mois.".jpg' width='250'></CENTER><br>\n";
echo '<p align="right"><FONT COLOR="#FFFFFF" size=2><INPUT TYPE="checkbox" NAME="affichage" value="oui"';
if ($_SESSION[det_page] == "1")
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'det_page=1'))
$add=str_replace("det_page=1","det_page=0",$add);
else $add=$add."".$add2."det_page=0";
echo "checked onClick=\"window.location.replace('$add')\">";
}
else
{
$add=$_SERVER['REQUEST_URI'];
if (strstr($add, '?')) $add2="&";
else $add2="?";
if (strstr($add, 'det_page=0'))
$add=str_replace("det_page=0","det_page=1",$add);
else $add=$add."".$add2."det_page=1";
echo " onClick=\"window.location.replace('$add')\">";
}
echo $lang['aff_det']."</font>";
?>
</td>
</tr></TR>
</TABLE>
<?PHP
// echo "<CENTER><img name='Titre border='0' src='./img/titre/titre_sortie_mois_".$Num_mois.".jpg'></CENTER>\n";
echo "<hr width='600' color='".Color_Trad."'>\n";
echo "<table border='0' width='100%'>\n";
echo "<tr>\n";
$num_mois = mois($Num_mois_dernier);
echo "<td width=10%><a href=?".PAGE."&decale_mois=$decale_mois_dernier><img src='".$racine."img/menu/bas_page/precedente.gif' width='58' height='48' border='0'></a></td><td width=20% nowrap><a href=?".PAGE."&decale_mois=$decale_mois_dernier>".$lang['titre_Smois']."$num_mois $Num_annee_mois_dernier</a></td>\n";
echo "<td width=40%>\n";
echo " ";
echo "</td>\n";
echo "<td width=20% nowrap>\n";
$num_mois = mois($Num_mois_suivant);
echo "<p align='right'><a href='?".PAGE."&decale_mois=$decale_mois_suivant'>".$lang['titre_Smois']."$num_mois $Num_annee_mois_suivant</a></td><td width=10%><a href='?".PAGE."&decale_mois=$decale_mois_suivant'><img src='".$racine."img/menu/bas_page/suivante.gif' width='58' height='48' border='0'></a></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<hr width='600' color='".Color_Trad."'>\n";
if ($_SESSION[det_page]==0)
{
echo "<table width='600' cellpadding='0' cellspacing='0'>\n";
echo "<tr width='550'><td align='center' >\n";
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>';}
//
//ici c le code qui affiche les resultas de votre requete, tout depend du script
//par exemple:
while($tab = mysql_fetch_assoc($req)){
// remplacement du carracter ' par \' pour la requette SQL
$titre_sql = addslashes ($tab['titre_film']);
$query_info_film="SELECT * FROM film WHERE titre_film='".$titre_sql."' AND Z1='".$tab['Z1']."' AND Z2_fr='".$tab['Z2_fr']."' AND Z2_su='".$tab['Z2_su']."' AND Z2_it='".$tab['Z2_it']."' AND Z2_de='".$tab['Z2_de']."' AND Z2_au='".$tab['Z2_au']."' AND blue_ray='".$tab['blue_ray']."' AND hd_dvd='".$tab['hd_dvd']."' AND dvd='".$tab['dvd']."'";
$result_info_film=mysql_query($query_info_film);
$info_film=mysql_fetch_array($result_info_film);
if ($info_film['Z1'] == 1) $zone = "1";
if ($info_film['Z2_fr'] == 1) $zone = "2";
if ($info_film['Z2_su'] == 1) $zone = "2 Ch";
if ($info_film['Z2_it'] == 1) $zone = "2 It";
if ($info_film['Z2_de'] == 1) $zone = "2 De";
if ($info_film['Z2_au'] == 1) $zone = "2";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// affichage des page par images
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($_SESSION[det_page]==0)
{
if ($i==Nbr_vignette)
{
echo "</tr></table><hr width='600' color='".Color_Trad."'>";
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>';
$i=0;
}
//image du film
echo '<td align="center"><div =align="center"><table><tr><td>';
echo "<CENTER><b><font size='1'>".$lang['Zone'];
echo "$zone </b></font></CENTER></td></tr>";
if($info_film[blue_ray]=="1")
{
echo "<tr><td align='center'><img src='http://".$_SERVER[HTTP_HOST]."/img/logo_blu_ray.gif' border='0' alt='blu ray'></td></tr><tr><td>";
}
else if($info_film[hd_dvd]=="1")
{
echo "<tr><td align='center'><img src='http://".$_SERVER[HTTP_HOST]."/img/logo_hd.gif' border='0' alt='hd dvd'></td></tr><tr><td>";
}
else
{
echo "<tr><td align='center'><img src='http://".$_SERVER[HTTP_HOST]."/img/logo_dvd.gif' border='0' alt='dvd'></td></tr><tr><td>";
}
echo '<a href="?centre=fiche&fiche='.$info_film[num_film].'">';
echo '<a href="?centre=fiche&fiche='.$info_film[num_film].'">';
//echo '<CENTER><img src="tag2.php?num_film='.$info_film[num_film].'&login='.$login.'" height="140" border="0" alt="'.$info_film['titre_film'].'"></CENTER>';
/*
$qte_cde=func_info_film($info_film[num_film],$login);
if (!empty($qte_cde)) $qte_cde=$info_film['titre_film']." / Qte cmd : ".$qte_cde;
else $qte_cde=$info_film['titre_film'];
echo '<CENTER><img src="tag2.php?num_film='.$info_film[num_film].'&login='.$login.'" height="140" border="0" alt="'.$qte_cde.'"></CENTER>';
*/
$filename=$racine.$info_film[image_film];
if (file_exists($filename))
echo '<center><img src="http://'.$_SERVER[HTTP_HOST].'/'.$info_film[image_film].'" height="140" border="0" alt="'.$info_film[titre_film].'"></CENTER>';
else echo '<center><img src="http://'.$_SERVER[HTTP_HOST].'/img/films/visu.jpg" height="140" border="0" alt="'.$info_film[titre_film].'"></CENTER>';
echo "</CENTER></a></td></tr><tr><td>";
echo '<a href="?centre=fiche&fiche='.$info_film[num_film].'">';
if (strlen($info_film['titre_film'])>nbr_titre) $titre_film = mb_strimwidth($info_film['titre_film'], 0, nbr_titre+4, " ...");
else $titre_film = $info_film['titre_film'];
echo "<font size='1'><b><CENTER>".$titre_film."</CENTER></b></font></a></td></tr></table></td>\n";
$i++;
}
else
{
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// AFFICHAGE DETAILLER
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
include ('Affichage_detail.php');
}
}
/************************************************************************************************************************************************/
//on appele la fonction précédament créée pour afficher les liens vers les autres pages, vous pouvez l'appeler plusieurs fois s'il le faut
if ($_SESSION[det_page]==0)
echo "</tr></table></table>";//<hr width='600' color='FF0000'>";
else echo "<br>";
echo "<hr width='600' color='3333CC'>";
pgs($enreg_par_pg, $pg, $connect,$query,PAGE."&decale_mois",$decale_mois);
?>