File include, base on my max file age of my hosted images

I need to determine the appropriate html, base on how old the last modified time stamp is on a hosted image.

I do currently use php to determine a desktop or android layout, with include bodyandroid or body desktop test. Now need a max file age test.

So, now I need to use a fall back index.html if my home server crashes and images are not being updated on the host in last 2 hours.

Possible?

I am not sure if the below will work fully. It seems to work. Assuming filemtime includes date, it should. If not, every 24th to 26 hours it will think it is a young file. ???

<?php $last_mod = filemtime("OC.txt"); print("--Updated: "); print(date("m/j/y h:i", $last_mod)); print ("--UTC."); ?> <?php $Fileage = time()-filemtime("OC.txt"); // $Dateage = date()-filemdate("OC.txt"); if (time(UTC)-filemtime("OC.txt") > 7200) { //File is Older than 2 hours.; print("--Scripts are down. No home made radars. "); include("fullweather.html"); } else { //File is Younger than 2 hours.; print("-- $Fileage seconds old. "); }; ?>
Sponsor our Newsletter | Privacy Policy | Terms of Service