";
} elseif ($tnumber[1] > 1) {
$tracreport = "Tracking " . $tnumber[1] . " storm cells
";
} else {
// Sometimes the TRACreport is empty so we need to say that
$tracreport = "No data currently available
";
}
// Process the arrays
for($k=0;$k<$tnumber[1];$k++) {
// Sets the alert flag to 1 meaning that there is a storm within a given distance
// This can be used to display an alert to visitors
if ($tdistance[$k] <= $tracwarnmeasure) { $alertflag = 1;}
// This builds each line of text for each thunderstorm
$tracreport = $tracreport . "Cell ID " . $tid[$k] . " detected at " . $tdtime[$k] . " from " . $tdirection[$k] . "° at a distance of " . $tdistance[$k] . " miles. Storm is " . strtolower($tintensity[$k]) . " and " . trim(strtolower($ttrend[$k])) . ".
";
}
$tracreport = $tracreport . '
';
}
if ($alertflag == 1) {
// You can change the HTML in this warning to anything you want.
// I display it on my main webpage with a link to the lightning page
$tracwarning = '
LIGHTNING ALERT ... We have detected a nearby storm cell ...
';
}
echo $tracreport;
echo $tracwarning;
?>