User Tools

Site Tools


tutorials:other:online_playlist_on_your_website_with_php_mysql

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
tutorials:other:online_playlist_on_your_website_with_php_mysql [2019/07/09 16:18] – external edit 127.0.0.1tutorials:other:online_playlist_on_your_website_with_php_mysql [2021/06/18 06:40] (current) – Version ohne Datenbank tw
Line 93: Line 93:
  
 As all entries are stored along with the date/time the song was started, it is also possible to implement a search function that looks up the songs played in a given time frame. As all entries are stored along with the date/time the song was started, it is also possible to implement a search function that looks up the songs played in a given time frame.
 +
 +====== Alternative Version without MySQL ======
 +
 +Here's a simple alternative version of the approach that does not use a database but only stores the current artist/title in a temporary file:
 +
 +inject.php:
 +
 +<code php>
 +<?php
 +
 +$handle = fopen('/tmp/nowplaying.txt', 'w');
 +fwrite($handle, $_REQUEST['artist']. "\n");
 +fwrite($handle, $_REQUEST['title']. "\n");
 +fclose($handle);
 +
 +print "OK";
 +</code>
 +
 +nowplaying.php:
 +
 +<code php>
 +<?php
 +
 +$handle = fopen('/tmp/nowplaying.txt', 'r');
 +$artist = fgets($handle);
 +$title = fgets($handle);
 +fclose($handle);
 +
 +print "Now playing: $artist - $title";
 +</code>
  
tutorials/other/online_playlist_on_your_website_with_php_mysql.txt · Last modified: 2021/06/18 06:40 by tw

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki