n
425c725443
All checks were successful
lint / lint (push) Successful in 21s
https://www.php.net/manual/en/function.strftime.php
61 lines
1.3 KiB
PHP
61 lines
1.3 KiB
PHP
<?php
|
|
|
|
/* fixe un timer */
|
|
|
|
function settimer($TimerName, $String)
|
|
{
|
|
$FileTimerName = "modules/timers/$TimerName.csv";
|
|
|
|
$Date = date_format(date_create(), "YmdHis");
|
|
|
|
$fp = fopen("$FileTimerName", "w+");
|
|
$Ligne = sprintf("\"".$Date."\",\"".$String."\"\n");
|
|
fwrite($fp, $Ligne);
|
|
fclose($fp);
|
|
// echo "fichier créé<br>";
|
|
}
|
|
|
|
/* renvoie $string si le temps n'est pas écoulé, ou FALSE sinon */
|
|
|
|
function timer($TimerName, $TimerNb)
|
|
{
|
|
|
|
$FileTimerN = "modules/timers/$TimerName.csv";
|
|
|
|
$Date = date_format(date_create(), "YmdHis");
|
|
|
|
if (!file_exists("$FileTimerN")) {
|
|
$timer = false;
|
|
} else {
|
|
// lecture de la date stockée dans le fichier
|
|
$fp = fopen("$FileTimerN", "r");
|
|
$data = fgetcsv($fp, 1000, ",");
|
|
fclose($fp);
|
|
|
|
$FileDate = $data[0];
|
|
$Date = date_format(date_create(), "YmdHis");
|
|
|
|
$String = $data[1];
|
|
|
|
if ($Date >= ($FileDate + $TimerNb)) {
|
|
// echo "date dépassée:".$Date." >= ".($FileDate+$TimerNb)."<br>";
|
|
$timer = false;
|
|
} else {
|
|
$timer = $String;
|
|
}
|
|
}
|
|
|
|
return $timer;
|
|
}
|
|
|
|
/* renvoie l'heure française (format HH:MM) */
|
|
|
|
function iheure()
|
|
{
|
|
if ($HTTP_GET_VARS["IFRANCE"] == "1") {
|
|
$iheure = $I_HEURE_UK;
|
|
} else {
|
|
$iheure = date("H:i");
|
|
}
|
|
return $iheure;
|
|
}
|