a couple of days ago (unfortunately) my web site has been hacked. In order to prevent it I'd like to include a PHP which checks if any file has been changed/added in the last 2 days. My starting point is the following function:
function topmods($dir)
{
$mods = array();
foreach (glob($dir . '/*') as $f) {
$mods[] = filemtime($f);
}
sort($mods);
$mods = array_reverse($mods);
return $mods;
}
I'd like hower to improve it so that only files changed in the last 2 days are included in the array. Any suggestion how to rewrite the foreach function so that you include in the array only files that satisfy this condition?
if (time() - filemtime($testfile) >= 2 * 86400)
Thanks