display.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /* GNUkebox -- a free software server for recording your listening habits
  3. Copyright (C) 2009, 2011 Free Software Foundation, Inc
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU Affero General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. header('Content-type: text/html; charset=utf-8');
  16. require_once('database.php');
  17. require_once('utils/human-time.php');
  18. require_once('temp-utils.php');
  19. require_once('version.php');
  20. ?>
  21. <!DOCTYPE html>
  22. <html>
  23. <head>
  24. <title>GNUkebox</title>
  25. </head>
  26. <body>
  27. <h2>Recent tracks</h2>
  28. <?php
  29. $adodb->SetFetchMode(ADODB_FETCH_ASSOC);
  30. try {
  31. $res = $adodb->CacheGetAll(300, 'SELECT artist, track, time FROM Scrobbles ORDER BY time DESC LIMIT 500');
  32. } catch (Exception $e) {
  33. die($e->getMessage());
  34. }
  35. echo "<ul>\n";
  36. foreach ($res as &$row){
  37. echo "<li>" . $row['artist'] . "&mdash;" . $row['track'] . "</li>\n";
  38. }
  39. ?>
  40. </ul>
  41. <p>This server is powered by <a href="https://gitorious.org/foocorp/gnu-fm">GNU FM</a> version <?php echo $version; ?></p>
  42. </body>
  43. </html>