*/
if (!isset($wfo)&&!isset($product)) {
$wfo='lix';
$divWidth = '656'; // They are used for testing only
$product = "HWO";
$leftMargin = 50; // Left margin to display text
$mapPath = './images/';
}
/* End of testing code defaults and section to comment out */
if (isset($_POST['wfo'])) { # Are we using AJAX???
$wfo = $_POST['wfo']; # If so, set wfo.
if ($_SERVER["REMOTE_ADDR"]=='127.0.0.1') {
include ('Settings.php'); // AJAX forgets these on localhost!
}
}
if (isset($_POST['divWidth'])) { # Are we using AJAX???
$divWidth = $_POST['divWidth']; # If so, set wfo.
if ($_SERVER["REMOTE_ADDR"]=='127.0.0.1') {
include ('Settings.php'); // AJAX forgets these on localhost!
}
}
if (isset($_POST['product'])) { # Are we using AJAX???
$product = $_POST['product']; # If so, set wfo.
if ($_SERVER["REMOTE_ADDR"]=='127.0.0.1') {
include ('Settings.php'); // AJAX forgets these on localhost!
}
}
if (isset($_POST['leftMargin'])) { # Are we using AJAX???
$leftMargin = $_POST['leftMargin']; # If so, set wfo.
if ($_SERVER["REMOTE_ADDR"]=='127.0.0.1') {
include ('Settings.php'); // AJAX forgets these on localhost!
}
}
if (isset($_POST['mapPath'])) { # Are we using AJAX???
$mapPath = $_POST['mapPath']; # If so, set wfo.
if ($_SERVER["REMOTE_ADDR"]=='127.0.0.1') {
include ('Settings.php'); // AJAX forgets these on localhost!
}
}
$locationArrays = array(
array("afc","AK, Anchorage"),
array("afg","AK, Fairbanks"),
array("ajk","AK, Juneau"),
array("bmx","AL, Birmingham"),
array("mob","AL, Mobile"),
array("hun","AL, Huntsville"),
array("fgz","AZ, Flagstaff"),
array("psr","AZ, Phoenix"),
array("twc","AZ, Tucson"),
array("lzk","AR, Little Rock"),
array("eka","CA, Eureka"),
array("hnx","CA, Hanford/San Joaquin Vly."),
array("lox","CA, Los Angeles/Oxnard"),
array("sto","CA, Sacramento"),
array("sgx","CA, San Diego"),
array("mtr","CA, San Francisco Bay/Monterey"),
array("bou","CO, Denver/Boulder"),
array("gjt","CO, Grand Junction"),
array("pub","CO, Pueblo"),
array("jax","FL, Jacksonville"),
array("eyw","FL, Key West"),
array("mlb","FL, Melbourne"),
array("mfl","FL, Miami"),
array("tae","FL, Tallahassee"),
array("tbw","FL, Tampa Bay Area"),
array("ffc","GA, Atlanta/Peachtree City"),
array("pq","GU, Tiyan"),
array("hnl","HI, Honolulu"),
array("boi","ID, Boise"),
array("pih","ID, Pocatello"),
array("ilx","IL, Lincoln"),
array("lot","IL, Chicago"),
array("ind","IN, Indianapolis"),
array("iwx","IN, Northern Indiana"),
array("dmx","IA, Des Moines"),
array("dvn","IA, Quad Cities/Davenport"),
array("ddc","KS, Dodge City"),
array("gld","KS, Goodland"),
array("top","KS, Topeka"),
array("ict","KS, Wichita"),
array("lmk","KY, Louisville"),
array("pah","KY, Paducah"),
array("lch","LA, Lake Charles"),
array("lix","LA, New Orleans"),
array("shv","LA, Shreveport"),
array("car","ME, Caribou"),
array("gyx","ME, Portland"),
array("box","MA, Boston/Taunton"),
array("dtx","MI, Detroit"),
array("apx","MI, Gaylord"),
array("grr","MI, Grand Rapids"),
array("mqt","MI, Marquette"),
array("dlh","MN, Duluth"),
array("mpx","MN, Twin Cities/Chanhassen"),
array("jan","MS, Jackson"),
array("eax","MO, Kansas City"),
array("sgf","MO, Springfield"),
array("lsx","MO, St. Louis"),
array("byz","MT, Billings"),
array("ggw","MT, Glasgow"),
array("tfx","MT, Great Falls"),
array("mso","MT, Missoula"),
array("gid","NE, Hastings"),
array("lbf","NE, North Platte"),
array("oax","NE, Omaha"),
array("lkn","NV, Elko"),
array("vef","NV, Las Vegas"),
array("rev","NV, Reno"),
array("abq","NM, Albuquerque"),
array("aly","NY, Albany"),
array("bgm","NY, Binghamton"),
array("buf","NY, Buffalo"),
array("okx","NY, New York City/Upton, NY"),
array("rah","NC, Raleigh/Durham"),
array("mhx","NC, Morehead City"),
array("ilm","NC, Wilmington"),
array("bis","ND, Bismarck"),
array("fgf","ND, Grand Forks"),
array("cle","OH, Cleveland"),
array("iln","OH, Wilmington/Dayton"),
array("oun","OK, Norman"),
array("tsa","OK, Tulsa"),
array("mfr","OR, Medford"),
array("pdt","OR, Pendleton"),
array("pqr","OR, Portland"),
array("phi","PA, Philadelphia/Mt. Holly, NJ"),
array("pbz","PA, Pittsburgh"),
array("ctp","PA, State College"),
array("sju","PR, San Juan"),
array("chs","SC, Charleston"),
array("cae","SC, Columbia"),
array("gsp","SC, Greenville/Spartanburg"),
array("abr","SD, Aberdeen"),
array("unr","SD, Rapid City"),
array("fsd","SD, Sioux falls"),
array("mrx","TN, Knoxville/Tri Cities"),
array("meg","TN, Memphis"),
array("ohx","TN, Nashville"),
array("ama","TX, Amarillo"),
array("bro","TX, Brownsville"),
array("crp","TX, Corpus Christi"),
array("fwd","TX, Dallas/Fort Worth"),
array("epz","TX, El Paso"),
array("hgx","TX, Houston/Galveston"),
array("lub","TX, Lubbock"),
array("sjt","TX, San Angelo"),
array("ewx","TX, San Antonio/Austin"),
array("slc","UT, Salt Lake City"),
array("btv","VT, Burlington"),
array("rnk","VA, Roanoke/Blacksburg"),
array("akq","VA, Wakefield"),
array("sew","WA, Seattle/Tacoma"),
array("otx","WA, Spokane"),
array("lwx","MD, Washington/Baltimore"),
array("rlx","WV, Charleston"),
array("grb","WI, Green Bay"),
array("arx","WI, La Crosse"),
array("mkx","WI, Milwaukee"),
array("cys","WY, Cheyenne"),
array("riw","WY, Riverton")
);
foreach ($locationArrays as $key => $val) {
if ($val[0] === $wfo) {
$wfoText = $locationArrays[$key][1];
break;
}
}
$matches = preg_split("/[,]+/",$wfoText);
$city = trim($matches[1]);
$state = $matches[0];
$wfoText = $city.', '.$state;
?>
$val) {
if ($val[0] == $product) {
$productText = $productArrays[$key][1];
break;
}
}
?>
for
To Select Another NWS Office Click on Map or Choose from List
Select Forecast Office:
Select Product:
\n";
$cacheName = $cacheFileDir . $cacheName;
// refresh cached copy of page if needed
// fetch/cache code by Tom at carterlake.org
if (file_exists($cacheName) and filemtime($cacheName) + $refetchSeconds > time()) {
$Status .= "\n";
$html = implode('', file($cacheName));
} else {
print "\n";
$html = FD_fetchUrlWithoutHanging($fileName);
$fp = fopen($cacheName, "w");
if ($fp) {
$write = fputs($fp, $html);
fclose($fp);
$Status .= "\n";
} else {
$Status .= "\n";
}
}
// extract the forecast discussion
preg_match('|
]*>(.*)
|Usi',$html,$matches);
$discussion = isset($matches[1])?$matches[1]:''; // now have the forecast as a string with \n delimiters
if (strlen($discussion)) $discussion = trim($matches[1]); // prevent extra white space at beginning and end
// uncomment next line if you like only lower case text, or it could be made an option
// $discussion = strtolower(trim($matches[1]));
print $Status;
if ($discussion == '') {
$discussion = 'NWS '.$productText.' for '.$wfoText.' currently not available.';
} ?>
Previous ".$productText."s may be found at NWS $wfoText ($wfo) Office ".$productText."s. (Click 'Previous Version' there to view past versions successively. Some may differ only in time posted.)\n"; ?>