Salut Marco,
Voila le script php ou il y a le choix des dates (je l'ai rétouché pour supprimer le superflu) :
Code :
<?php
if(isset($_GET['day'])) $day=$_GET['day'];
if(isset($_GET['month'])) $month=$_GET['month'];
if(isset($_GET['year'])) $year=$_GET['year'];
if(isset($_GET['delta'])) $delta=$_GET['delta'];
if (isset($month)&&isset($day)&&isset($year))
{
$start=mktime(0,0,0,$month,$day,$year);
$stop=$start+$delta*24*3600;
}
else
{
$LAST_UPDATE=time();
$DELTA=$LAST_UPDATE-86400;
$minutes =date("i",$DELTA);
$seconds =date("s",$DELTA);
$start=$DELTA-$seconds-$minutes*60;
$stop=$LAST_UPDATE;
$day =date("d",$start);
$month=date("m",$start);
$year =date("y",$start);
}
?>
<form name="ByDay" method="GET" action="LeNomDeCeScript.php">
Date :
<select id="Day" name="day">
<?php
for($i=1;$i<=31;$i++)
if ($i==$day) echo "<option value="$i" selected>$i</option>";
else echo "<option value="$i">$i</option>";
?>
</select>
<select id="Month" name="month" >
<?php
$month_name=array( "janvier","fevrier","mars","avril","mai","juin","juillet","aout","septembre","octobre","novembre","decembre");
for($i=1;$i<=12;$i++)
if ($i==$month) echo "<option value="$i" selected>".$month_name[$i-1]."</option>";
else echo "<option value="$i">".$month_name[$i-1]."</option>";
?>
</select>
<select id="Year" name="year" >
<?php
for($i=2005;$i<=2007;$i++)
if ($i==$year) echo "<option value="$i" selected>$i</option>";
else echo "<option value="$i">$i</option>";
?>
</select>
<br/><br/>Tracer sur :
<select id="Delta" name="delta">
<?php
$delta_array=array(1,2,3,4,5,10,20,30,90,180,360);
for($i=0;$i<count($delta_array);$i++)
if ($delta_array[$i]==$delta) echo "<option value="$delta_array[$i]" selected>$delta_array[$i]</option>";
else echo "<option value="$delta_array[$i]">$delta_array[$i]</option>";
?>
</select>
jours
<input type="hidden" name="page" id="page" value="meteo"/>
</blockquote></blockquote><hr>
<div class="center"><input type="submit" value="Generer !"></div>
</form>
<br/>
<?php
echo "<img src="http://192.168.1.11:82/graphs?format=jpg&starttime=$start&stoptime=$stop"></img><br><br>";
echo "<img src="http://192.168.1.11:82/graphs?format=jpg&starttime=$start&stoptime=$stop&stylesheet=gradient.xml"></img><br><br>";
?>
C'etait bien le code qui était sur ma page météo, en espérant que ca t'inspire.
C'est normal si tu n'arrives pas à te connecter à ma page, GraphWeather n'est pas souvent en marche chez moi (je programme la 1.5.1 et impossible de faire tout tourner ensemble).
Bonne soirée,
Antoine.