66 lines
1.5 KiB
PHP
66 lines
1.5 KiB
PHP
|
<?
|
|||
|
/* fixe un timer */
|
|||
|
|
|||
|
function settimer($TimerName,$String)
|
|||
|
{
|
|||
|
$FileTimerName = "modules/timers/$TimerName.csv";
|
|||
|
|
|||
|
$Date = mktime();
|
|||
|
$fp = fopen("$FileTimerName","w+");
|
|||
|
$Ligne = sprintf("\"".$Date."\",\"".$String."\"\n");
|
|||
|
fwrite($fp,$Ligne);
|
|||
|
fclose($fp);
|
|||
|
// echo "fichier cr<63><72><br>";
|
|||
|
}
|
|||
|
|
|||
|
/* renvoie $string si le temps n'est pas <20>coul<75>, ou FALSE sinon */
|
|||
|
|
|||
|
function timer($TimerName,$TimerNb)
|
|||
|
{
|
|||
|
|
|||
|
$FileTimerN = "/web/tma/modules/timers/$TimerName.csv";
|
|||
|
|
|||
|
if (!file_exists("$FileTimerN"))
|
|||
|
{
|
|||
|
$timer = FALSE;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// lecture de la date stock<63>e dans le fichier
|
|||
|
$fp = fopen("$FileTimerN","r");
|
|||
|
$data = fgetcsv($fp, 1000, ",");
|
|||
|
fclose($fp);
|
|||
|
|
|||
|
$FileDate = $data[0];
|
|||
|
//$Date = strftime ("%Y%m%d%H%M%S", time());
|
|||
|
$Date = mktime();
|
|||
|
|
|||
|
$String = $data[1];
|
|||
|
|
|||
|
if ($Date >= ($FileDate+$TimerNb))
|
|||
|
{
|
|||
|
//echo "date d<>pass<73>e:".$Date." >= ".($FileDate+$TimerNb)."<br>";
|
|||
|
$timer = FALSE;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
$timer = $String;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return $timer;
|
|||
|
}
|
|||
|
|
|||
|
/* renvoie l'heure fran<61>aise (format HH:MM) */
|
|||
|
|
|||
|
function iheure()
|
|||
|
{
|
|||
|
if ($HTTP_GET_VARS["IFRANCE"] =="1")
|
|||
|
$iheure=$I_HEURE_UK;
|
|||
|
else
|
|||
|
$iheure= date("H:i");
|
|||
|
return $iheure;
|
|||
|
}
|
|||
|
|
|||
|
?>
|