<?php

include 'dbconn.php';

// Zwróć wiadomości z ostatnich 20 minut
$sql = "SELECT * FROM flashChat WHERE dateAdded > " . (time() - (60 * 15));

$result = mysql_query($sql);

$xmlData = "<messages>\n";

while ($row = mysql_fetch_array($result))
{
   $xmlData .=  "   <message id='" . $row['id'] . "'>\n";
   $xmlData .=  "      <name>" . $row['username'] . "</name>\n";
   $xmlData .=  "      <msg>" . $row['message'] . "</msg>\n";
   $xmlData .=  "   </message>\n";
}

$xmlData .= "</messages>";

print $xmlData;

?>
