You are here: Re: To cange the last modidied date of a file « PHP Programming Language « IT news, forums, messages
Re: To cange the last modidied date of a file

Posted by Steel on 01/20/06 15:41

"Pedro Graca"
kindly wrote:
> clearstatcache();
> $origtime = getdate(filemtime($FileName));
> $newtime = mktime(0, 0, 0, $origtime['mon'], 1+$origtime['mday'],
$origtime['year']);
>
> ### answer the questions above and either uncomment or remove the
> ### following line
> // $newtime += 24*60*60;
>
> touch($FileName, $newtime);
>
>
> You may have some problems when DST starts/ends. Perhaps you can use
> gmmktime() instead.
>
> --

Well,
Thank you
At last my full script is:
<?php
$FileName = 'sem.txt';
clearstatcache();
$origtime = getdate(filemtime($FileName));
$Today=strtotime("now")
if $Today>$origtime
{
$newtime = mktime(2, 0, 0, $origtime['mon'],
1+$origtime['mday'],$origtime['year']);
touch($FileName, $newtime);
if ($handle = opendir('./cgi-bin/sessions')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..")
{unlink("./cgi-bin/sessions/" . $file);}
}
closedir($handle);
}
}
?>

My script try to delete all temporany files if user date is up the last
modified date of the file sem.txt
After it try to update the last modified date of the sem.txt adding 24
hours.
I'ld like very much to knoe if there are errors?
Thank in advance
Steel

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация