Rafraichire tous un code php toute les 10 seconde

Résolu
rxx941 Messages postés 14 Date d'inscription vendredi 5 août 2005 Statut Membre Dernière intervention 1 mars 2011 - 10 févr. 2011 à 17:24
rxx941 Messages postés 14 Date d'inscription vendredi 5 août 2005 Statut Membre Dernière intervention 1 mars 2011 - 11 févr. 2011 à 15:56
Bonjour,
Je cherche un moyen de rafraichir ce code php d'un module xoops mais je ne connais pas le moyen d'y arriver.
on ma proposer ce code mais sa ne change rien:
<head>
<script type="text/javascript">

function writediv(texte, endroit)

{

document.getElementById(endroit).innerHTML = texte;

}



function afficher()

{



if(texte = file('index.php'')) // Ton fichier à inclure dans la


{

writediv(''+texte+'

', 'ghost'); // chat =
, c'est l'emplacement où tu veux placer ta page

}

}



function file(fichier)

{

if(window.XMLHttpRequest) // FIREFOX

xhr_object = new XMLHttpRequest();

else if(window.ActiveXObject) // IE

xhr_object = new ActiveXObject("Microsoft.XMLHTTP");

else

return(false);

xhr_object.open("GET", fichier, false);

xhr_object.send(null);

if(xhr_object.readyState == 4) return(xhr_object.responseText);
.
else return(false);

}



setInterval('afficher()', 10000); // nombre de milisecondes entre deux rafraichissements : ici 10 secondes

</script>
</head>


<?

// Récupération de la date et de l'heure.
$jour=date('w');
$h=date('H');

// Affichage du jour selon la variable $jour
switch($jour)
{

// Dimanche

case 0:
// Affichage du message selon la variable d'heures $h
switch($h)
{
////// Pour ajouter plus de message ajoutez ceci après break; :
// case $h>=00 && $h<10:
// echo 'Texte';
// break;
////// Vous pouvez éxécuter autre chose que du texte comme des autres script, des conditions if,else, etc...
case $h>=00 && $h<12:
echo '24h00 - Les nocturnes
A suivre:
12h00 - BmFm week-end avec Patrick';
break;
case $h>=12 && $h<15:
echo '12h00 - BmFm week-end avec Patrick
A suivre:
15h00 - L essenciel de la musique';
break;
case $h>=15 && $h<16:
echo '15h00 - L essenciel de la musique
A suivre:
16h00 - L afternoon du week-end avec Fab';
break;
case $h>=16 && $h<20:
echo '16h00 - L afternoon du week-end avec Fab
A suivre:
20h00 - Night Fever avec Joseph';
break;
case $h>=20 && $h<24:
echo '20h00 Night Fever avec Joseph
A suivre:
24h00 - Les nocturnes';
break;
default :
echo 'Probleme avec l\heure'; // Les heures doivent être continuent donc 00 à 10 de 10 à 20 et de 20 à 24
}
break;

// Lundi

case 1:
switch($h)
{
case $h>=00 && $h<06:
echo '24h00 - Les nocturnes
A suivre:
06h00 - Le Wake UP avec Vince & Cristina';
break;
case $h>=06 && $h<10:
echo '06h00 - Le Wake UP avec Vince & Cristina
A suivre:
10h00 - Les Matinales avec Michel';
break;
case $h>=10 && $h<13:
echo '10h00 - Les Matinales avec Michel
A suivre:
13h00 - Bmfm sélection actualité des stars avec Eric';
break;
case $h>=13 && $h<15:
echo '13h00 - Bmfm sélection actualité des stars avec Eric
A suivre:
15h00 - Michel';
break;
case $h>=15 && $h<17:
echo '15h00 - Michel
A suivre:
17h00 - Si On Se Faisit Plaisir! avec Marco et Natacha';
break;
case $h>=17 && $h<19:
echo '17h00 - Si On Se Faisit Plaisir! avec Marco et Natacha
A suivre:
19h00 - Les Soirées 80 avec Albert Georges';
break;
case $h>=19 && $h<22:
echo '19h00 - Les Soirées 80 avec Albert Georges
A suivre
22h00 - LatinAfrica avec Campbell';
break;
break;
case $h>=22 && $h<24:
echo '22h00 - LatinAfrica avec Campbell
A suivre
24h00 - Les nocturnes';
break;
echo 'Probleme avec l\heure';
}
break;

//Mardi

case 2:
switch($h)
{
case $h>=00 && $h<06:
echo '24h00 - Les nocturnes
A suivre:
06h00 - Le Wake UP avec Vince & Cristina';
break;
case $h>=06 && $h<10:
echo '06h00 - Le Wake UP avec Vince & Cristina
A suivre:
10h00 - Les Matinales avec Michel';
break;
case $h>=10 && $h<13:
echo '10h00 - Les Matinales avec Michel
A suivre:
13h00 - Bmfm sélection actualité des stars avec Eric';
break;
case $h>=13 && $h<15:
echo '13h00 - Bmfm sélection actualité des stars avec Eric
A suivre:
15h00 - Michel';
break;
case $h>=15 && $h<17:
echo '15h00 - Michel
A suivre:
17h00 - Si On Se Faisit Plaisir! avec Marco et Natacha';
break;
case $h>=17 && $h<19:
echo '17h00 - Si On Se Faisit Plaisir! avec Marco et Natacha
A suivre:
19h00 - Les Soirées 80 avec Albert Georges';
break;
case $h>=19 && $h<22:
echo '19h00 - Les Soirées 80 avec Albert Georges
A suivre
22h00 - LatinAfrica avec Campbell';
break;
break;
case $h>=22 && $h<24:
echo '22h00 - LatinAfrica avec Campbell
A suivre
24h00 - Les nocturnes';
break;
default :
echo 'Probleme avec l\heure';
}
break;

// Mercredi

case 3:
switch($h)
{
case $h>=00 && $h<06:
echo '24h00 - Les nocturnes
A suivre:
06h00 - Le Wake UP avec Vince & Cristina';
break;
case $h>=06 && $h<10:
echo '06h00 - Le Wake UP avec Vince & Cristina
A suivre:
10h00 - Les Matinales avec Michel';
break;
case $h>=10 && $h<13:
echo '10h00 - Les Matinales avec Michel
A suivre:
13h00 - Bmfm sélection actualité des stars avec Eric';
break;
case $h>=13 && $h<15:
echo '13h00 - Bmfm sélection actualité des stars avec Eric
A suivre:
15h00 - Michel';
break;
case $h>=15 && $h<17:
echo '15h00 - Michel
A suivre:
17h00 - Si On Se Faisit Plaisir! avec Marco et Natacha';
break;
case $h>=17 && $h<19:
echo '17h00 - Si On Se Faisit Plaisir! avec Marco et Natacha
A suivre:
19h00 - Les Soirées 80 avec Albert Georges';
break;
case $h>=19 && $h<22:
echo '19h00 - Les Soirées 80 avec Albert Georges
A suivre
22h00 - LatinAfrica avec Campbell';
break;
break;
case $h>=22 && $h<24:
echo '22h00 - LatinAfrica avec Campbell
A suivre
24h00 - Les nocturnes';
break;
default :
echo 'Probleme avec l\heure';
}
break;

// Jeudi

case 4:
switch($h)
{
case $h>=00 && $h<06:
echo '24h00 - Les nocturnes
A suivre:
06h00 - Le Wake UP avec Vince & Cristina';
break;
case $h>=06 && $h<10:
echo '06h00 - Le Wake UP avec Vince & Cristina
A suivre:
10h00 - Les Matinales avec Michel';
break;
case $h>=10 && $h<13:
echo '10h00 - Les Matinales avec Michel
A suivre:
13h00 - Bmfm sélection actualité des stars avec Eric';
break;
case $h>=13 && $h<15:
echo '13h00 - Bmfm sélection actualité des stars avec Eric
A suivre:
15h00 - Michel';
break;
case $h>=15 && $h<17:
echo '15h00 - Michel
A suivre:
17h00 - Si On Se Faisit Plaisir! avec Marco et Natacha';
break;
case $h>=17 && $h<19:
echo '17h00 - Si On Se Faisit Plaisir! avec Marco et Natacha
A suivre:
19h00 - Les Soirées 80 avec Albert Georges';
break;
case $h>=19 && $h<22:
echo '19h00 - Les Soirées 80 avec Albert Georges
A suivre
22h00 - LatinAfrica avec Campbell';
break;
break;
case $h>=22 && $h<24:
echo '22h00 - LatinAfrica avec Campbell
A suivre
24h00 - Les nocturnes';
break;
default :
echo 'Probleme avec l\heure';
}
break;

//Vendredi

case 5:
switch($h)
{
case $h>=00 && $h<06:
echo '24h00 - Les nocturnes
A suivre:
06h00 - Le Wake UP avec Vince & Cristina';
break;
case $h>=06 && $h<10:
echo '06h00 - Le Wake UP avec Vince & Cristina
A suivre:
10h00 - Les Matinales avec Michel';
break;
case $h>=10 && $h<13:
echo '10h00 - Les Matinales avec Michel
A suivre:
13h00 - Bmfm sélection actualité des stars avec Eric';
break;
case $h>=13 && $h<15:
echo '13h00 - Bmfm sélection actualité des stars avec Eric
A suivre:
15h00 - Michel';
break;
case $h>=15 && $h<17:
echo '15h00 - Michel
A suivre:
17h00 - Si On Se Faisit Plaisir! avec Marco et Natacha';
break;
case $h>=17 && $h<19:
echo '17h00 - Si On Se Faisit Plaisir! avec Marco et Natacha
A suivre:
19h00 - Les Soirées 80 avec Albert Georges';
break;
case $h>=19 && $h<22:
echo '19h00 - Les Soirées 80 avec Albert Georges
A suivre
22h00 - LatinAfrica avec Campbell';
break;
break;
case $h>=22 && $h<24:
echo '22h00 - LatinAfrica avec Campbell
A suivre
24h00 - Les nocturnes';
break;
default :
echo 'Probleme avec l\heure';
}
break;

// Samedi

case 6:
switch($h)
{
case $h>=00 && $h<12:
echo '24h00 - Les nocturnes
A suivre:
12h00 - BmFm week-end avec Patrick';
break;
case $h>=12 && $h<15:
echo '12h00 - BmFm week-end avec Patrick
A suivre:
15h00 - L essenciel de la musique';
break;
case $h>=15 && $h<16:
echo '15h00 - L essenciel de la musique
A suivre:
16h00 - L afternoon du week-end avec Fab';
break;
case $h>=16 && $h<20:
echo '16h00 - L afternoon du week-end avec Fab
A suivre:
20h00 - Night Fever avec Joseph';
break;
case $h>=20 && $h<24:
echo '20h00 Night Fever avec Joseph
A suivre:
24h00 - Les nocturnes';
break;
default :
echo 'Probleme avec l\heure';
}
break;
default:
echo 'Probleme avec le jour';
}
?>




Sa fait 3 jours que je cherche sans résultat je me tourne vers votre savoir
Merci de m'aider

4 réponses

cod57 Messages postés 1653 Date d'inscription dimanche 7 septembre 2008 Statut Membre Dernière intervention 11 septembre 2013 19
11 févr. 2011 à 14:06
une autre technique serait de creer une page.php ou html que tu inclus dans ta page principale avec un iframe html et le rafraichissement dans la page incluse ...
je sais pas si ça marche faudrait essayer

dans la page principale




dans page.php

<META HTTP-EQUIV="Refresh" CONTENT="3;URL=http://page.php?unevariable=unevaleur&unedeuxiemevariable=unevaleur2">
<?php
/*ce que tu veux*/
?>
3
cod57 Messages postés 1653 Date d'inscription dimanche 7 septembre 2008 Statut Membre Dernière intervention 11 septembre 2013 19
11 févr. 2011 à 11:37
as tu essayé un truc du genre

<META HTTP-EQUIV="Refresh" CONTENT="3;URL=http://tapage.php?unevariable=unevaleur&unedeuxiemevariable=unevaleur2">

a++
0
rxx941 Messages postés 14 Date d'inscription vendredi 5 août 2005 Statut Membre Dernière intervention 1 mars 2011
11 févr. 2011 à 12:02
Bonjour cod57,
J'ai essayer le code il fonctionne bien, le problème est que c'est toute la page accueil qui ce recharge.
Merci pour ton aide
0
rxx941 Messages postés 14 Date d'inscription vendredi 5 août 2005 Statut Membre Dernière intervention 1 mars 2011
11 févr. 2011 à 15:56
Impeccable sa fonctionne nikel.
encore un grand merci pour l'aide.
0
Rejoignez-nous