htdocs/datafile.php
author Dan
Sun, 14 Dec 2008 00:35:52 -0500
changeset 34 a8daa2016cf1
parent 20 e2f6e3af9959
permissions -rw-r--r--
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     1
<?php
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     2
header('Content-type: application/force-download');
20
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 8
diff changeset
     3
header('Content-disposition: attachment; filename=stats-data.csv');
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 8
diff changeset
     4
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 8
diff changeset
     5
require('../stats-fe.php');
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 8
diff changeset
     6
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 8
diff changeset
     7
echo "channel,nick,timestamp\n";
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     8
20
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 8
diff changeset
     9
$q = eb_mysql_query('SELECT channel, nick, time FROM stats_messages ORDER BY message_id ASC;');
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    10
20
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 8
diff changeset
    11
while ( $row = mysql_fetch_assoc($q) )
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 8
diff changeset
    12
{
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 8
diff changeset
    13
  echo "{$row['channel']},{$row['nick']},{$row['time']}\n";
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 8
diff changeset
    14
}
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 8
diff changeset
    15
e2f6e3af9959 Stats now uses MySQL backend
Dan
parents: 8
diff changeset
    16
mysql_free_result($q);