note 21014 added to function.time
| From: | fredrockford at topnet dot pl | Date: | Thu, 25 Apr 2002 12:25:17 +0000 |
| Subject: | note 21014 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29830@lists.php.net to get a copy of this message | ||
hi:~)
u can do simply compare, for eg. to check if the file is older than 5 minutes:
<?php
$str_status_filename = "emailing.status"; // nazwa pliku, ktory bedzie tworzony i
modyfikowany, jako status dzialania mailingu
if (file_exists($str_status_filename)) {
$int_status_filemtime = filemtime($str_status_filename);
echo "data pliku: $int_status_filemtime<BR>";
$czas = time();
$roznica = $czas - $int_status_filemtime;
echo "data: $czas<BR>";
echo "roznica: $roznica<BR>";
if ($roznica > 300) {
echo "KUKURYKU!<BR>";
}
} else {
echo "Nie ma pliku<BR>";
}
?>
of course, u have to make any file under the name emailing.status and wait 5 minutes (5 * 60
seconds) ;~)
note that time() and filemtime() returns time time in UNIX format for a GMT date
(above script is made & tested by me :~))
greetz :~)
Sir_Fred
/Martinez, I was made in Poland too :~)/
--
http://www.php.net/manual/en/function.time.php
http://master.php.net/manage/user-notes.php?action=edit+21014
http://master.php.net/manage/user-notes.php?action=delete+21014
http://master.php.net/manage/user-notes.php?action=reject+21014