htdocs/datafile.php
changeset 20 e2f6e3af9959
parent 8 0acb8d9a3194
--- a/htdocs/datafile.php	Sat Nov 15 14:59:51 2008 -0500
+++ b/htdocs/datafile.php	Sat Nov 15 15:00:52 2008 -0500
@@ -1,6 +1,16 @@
 <?php
 header('Content-type: application/force-download');
-header('Content-disposition: attachment; filename=stats-data.php');
+header('Content-disposition: attachment; filename=stats-data.csv');
+
+require('../stats-fe.php');
+
+echo "channel,nick,timestamp\n";
 
-echo file_get_contents('../stats-data.php');
+$q = eb_mysql_query('SELECT channel, nick, time FROM stats_messages ORDER BY message_id ASC;');
 
+while ( $row = mysql_fetch_assoc($q) )
+{
+  echo "{$row['channel']},{$row['nick']},{$row['time']}\n";
+}
+
+mysql_free_result($q);