include("connection.php"); if ((!$dbconnection) || (! mysql_select_db($databasename) )) { print "
Error connecting to database.
"; } else { include("feedcreator.class.php"); $rss = new UniversalFeedCreator(); $rss->useCached(); $rss->title = "Sywell Aerodrome Status"; $rss->description = "Updates on aerodrome surface and flying status"; $rss->link = "http://www.sywellaerodrome.co.uk/status.php"; $rss->syndicationURL = "http://www.sywellaerodrome.co.uk/".$PHP_SELF; $image = new FeedImage(); $image->title = "Sywell Aerodrome logo"; $image->url = "http://www.sywellaerodrome.co.uk/images/v4-sywellaerodromeheader.gif"; $image->link = "http://www.sywellaerodrome.co.uk"; $image->description = "Feed provided by Sywell Aerodrome. Click to visit."; $rss->image = $image; $res = mysql_query("SELECT * FROM airfield_status LIMIT 1"); while ($data = mysql_fetch_object($res)) { $item = new FeedItem(); $item->link = "http://www.sywellaerodrome.co.uk/status.php"; $lights = array('OK','Use caution','Unavailable'); $lighttexts = array('OK','Use caution (see below)','Unavailable (see below)'); $item->title = "Sywell Status - FW: " . $lights[$data->fixedwing] . ", H: " . $lights[$data->helo] . ', RW: ' . $data->runway . ' ' . $data->circuit; $updated = $data->updated; $current = substr($updated,11,5) . ' on ' . substr($updated,8,2) . '/' . substr($updated,5,2) . '/' . substr($updated,0,4); $desc = '' .
'Fixed wing ops:
' . $lighttexts[$data->fixedwing].
' Helicopter ops:
' . $lighttexts[$data->helo].
'
';
if ($data->runway != '')
{
$desc .= 'Runway in use: ' . $data->runway . ', circuit direction: ' . $data->circuit .
', closing at: ' . $data->closing . '.' .
'
';
}
else
{
$desc .= 'Sywell is unavailable to aircraft requiring the use of a licensed Aerodrome today.
';
}
$desc .= 'Information current as of ' . $current. ' (local). ';
$desc .= '
' . $data->status . '
'; $item->description = $desc; $item->date = $data->updated; $item->source = "http://www.sywellaerodrome.co.uk"; $item->author = "Sywell FIS"; $rss->addItem($item); } $rss->saveFeed("RSS1.0", "news/sywell_status.xml"); } ?>