<? header('Content-type: text/xml'); ?>
<?php
$today = date("Ymd"); 
?>
<?php require_once('Connections/medialogins.php'); ?>
<?php

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_medialogins, $medialogins);
$query_events = "SELECT * FROM arenaevents WHERE expires >= $today AND type = 'event' AND announcedate <= '$today' ORDER BY starts ASC";
$events = mysql_query($query_events, $medialogins) or die(mysql_error());
$row_events = mysql_fetch_assoc($events);
$totalRows_events = mysql_num_rows($events);

?>

<rss version="2.0">
<channel>

<title>Spokane Arena Upcoming Events</title>
<link>http://www.spokanearena.com/arenaevents.php</link>
<description>Calendar of upcoming events at the Spokane Arena</description>
<language>en-us</language>


<?php do {
echo "<item>
        <title>"; echo htmlentities(strip_tags($row_events['eventTitle'])); echo"</title>";
        echo "<description>"; echo htmlentities(strip_tags($row_events['date'])); echo "</description>";
        echo "<link>http://spokanearena.com/event.php?eventID="; echo $row_events['eventID']; echo "</link>";
     echo "</item>";
} while ($row_events = mysql_fetch_assoc($events)); ?>

</channel>
</rss>

