I've tried to do it so that text will flash for 30 minutes after the last strike has been detected. I thought I had it solved, but it fails too often and i'm not sure why.
Here's what I get CMX to upload for the lightning flash stuff:
Code: Select all
$lightningtimenum = "<#LightningTime format="yyyMMddHHmmss">";
$currenttime= date('ymjhi');
$lightningalert=date('ymjhi', strtotime($lightningtimenum));
$lightningtimeago= $lightningalert - $currenttime;
https://warehamwx.co.uk/gw1000.php?sce=view
I then used this on my webpage:
Code: Select all
<?php if ($lightningtimeago > -30) { echo '<span class="lightning_alert"> Lightning Nearby</span> '; } else { echo ' Lightning'; }?>
As it stands now, the last strike detected was 20 minutes ago, and $lightningtimeago shows -61.
I know the coding is a fudge, but I don't understand why $lightningtimeago is not being reset correctly?
Any help would be greatly appreciated.