Codeschnipsel - MP3 NO CACHING PLUGIN


English:

Plugin to stop the caching of MP3 files.
For the Flash MP3 Player from Jeroenwijering.
1. You create a php file named cachingplugin.php with the code
2. You rename playlist.xml to playlist.php
3. You modify playlist.php:
- You insert at the beginning of the XML-File the PHP-Header (previous the XML-Code)
- You modify the location of the MP3 Files:
- mp3/file.mp3 > cachingplugin.php?getpas=mp3/file.mp3
4. You insert the mod_rewrite Code OR
You modify your HTML-Code to set the new playlist File.

Deutsch:

Plugin zum stoppen des cachen von MP3 Dateien.
F ür den Flash MP3 Player von Jeroenwijering.
1. Sie erstellen eine PHP-Datei mit den Namen cachingplugin.php und den Code
2. Sie bennen playlist.xml zu playlist.php um
3. Sie bearbeiten playlist.php
- Sie fügen am Anfang der Playlist.php den PHP-Header ein (vor dem XML-Code)
- Sie bearbeiten den Pfad zu den MP3 Dateien
- mp3/datei.mp3 > cachingplugin.php?getpas=mp3/datei.mp3
4. Sie fügen den mod_rewrite Code ein ODER
Sie bearbeiten den HTML-Code zur neuen playlist Datei.

(cachingplugin.php)

Code:
<?php ########################################################################################################################### # CACHING Plugin by PA-S.de V.0.6 # (C) 2007 by http://www.PA-S.de # Plugin: http://www.pa-s.de/php/codeschnipsel-MP3-NO-CACHING-PLUGIN-51.php ###########################################################################################################################   $file = trim(htmlspecialchars($_GET['getpas'], ENT_QUOTES, "UTF-8")); if($file != NULL){ $url_info = parse_url($file); $pfad = $url_info[path]; $array = explode("/",$pfad); $filename = end($array); $fp=fopen($file,"r"); if ($fp) { header("Content-Transfer-Encoding: binary"); header("Expires: 0"); header("Pragma:no-cache"); header("Cache-Control:private,no-store,no-cache,must-revalidate"); header("Content-Type: audio/mpeg"); header("Accept-Ranges: bytes"); header("Content-Disposition: attachment; filename=".$filename.";"); while (!feof($fp)) { echo (@fgets($fp, 4096)); } fclose ($fp); } } exit; ?>

 

(playlist.php [PHP-HEADER])

Code:
<?php ########################################################################################################################### # CACHING Plugin by PA-S.de V.0.6 # (C) 2007 by http://www.PA-S.de # Plugin: http://www.pa-s.de/php/codeschnipsel-MP3-NO-CACHING-PLUGIN-51.php ########################################################################################################################### header('Content-type: text/xml'); header("Pragma:no-cache"); header("Cache-Control:private,no-store,no-cache,must-revalidate"); ?>

 

English:
You insert the PHP-Code previous the XML-Code.

If you have mod_rewrite add this Code to your .htaccess (All Versions):

Code:
RewriteEngine on RewriteRule ^playlist.xml$ playlist.php

OR:
You edit your HTML-Code: You must replace "playlist.xml" with "playlist.php" .

Example Version 3.5:

<script type="text/javascript">
var FU = { movie:"mp3player.swf",width:"240",height:"135",majorversion:"7",build:"0",bgcolor:"#FFFFFF",
flashvars:"file=playlist.php&lightcolor=0xCC0066&backcolor=0x000000
&frontcolor=0xFFFFFF&displayheight=0" };
UFO.create(FU,"player2");
</script>

Example Version 3.8:

<p id="player2"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</p>
<script type="text/javascript">
var s2 = new SWFObject("mp3player.swf", "playlist", "240", "135", "7");
s2.addVariable("file","playlist.php");
s2.addVariable("backcolor","0x00000");
s2.addVariable("frontcolor","0xEECCDD");
s2.addVariable("lightcolor","0xCC0066");
s2.addVariable("displayheight","0");
s2.write("player2");
</script>


Deutsch:
Sie müssen vor dem XML-Code den PHP-Code einfügen.

Wenn mod_rewrite zur verfügung steht, fügen Sie folgenden Code hinzu (Alle Versionen) :

Code:
RewriteEngine on RewriteRule ^playlist.xml$ playlist.php

Oder:
Sie bearbeiten Ihren HTML-Code: Sie müssen anstelle playlist.xml mit playlist.php ersetzen.

Beispiel Version 3.5:

<script type="text/javascript">
var FU = { movie:"mp3player.swf",width:"240",height:"135",majorversion:"7",build:"0",bgcolor:"#FFFFFF",
flashvars:"file=playlist.php&lightcolor=0xCC0066&backcolor=0x000000
&frontcolor=0xFFFFFF&displayheight=0" };
UFO.create(FU,"player2");
</script>

Beispiel Version 3.8:

<p id="player2"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</p>
<script type="text/javascript">
var s2 = new SWFObject("mp3player.swf", "playlist", "240", "135", "7");
s2.addVariable("file","playlist.php");
s2.addVariable("backcolor","0x00000");
s2.addVariable("frontcolor","0xEECCDD");
s2.addVariable("lightcolor","0xCC0066");
s2.addVariable("displayheight","0");
s2.write("player2");
</script>

COMPLETE EXAMPLE PLAYLIST:

Code:
<?php ########################################################################################################################### # CACHING Plugin by PA-S.de V.0.5 # (C) 2007 by http://www.PA-S.de # Plugin: http://www.pa-s.de/php/codeschnipsel-MP3-NO-CACHING-PLUGIN-51.php ########################################################################################################################### header('Content-type: text/xml'); header("Pragma:no-cache"); header("Cache-Control:private,no-store,no-cache,must-revalidate"); ?>   <playlist version="1" xmlns="http://xspf.org/ns/0/"> <trackList>   <track> <title>Homeland</title> <creator>Postman</creator> <location>cachingplugin.php?getpas=song1.mp3</location> </track>   <track> <title>Jazzalude</title> <creator>Basement Jaxx</creator> <location>cachingplugin.php?getpas=song2.mp3</location> <info>http://www.jeroenwijering.com</info> </track>   <track> <title>Homeland</title> <creator>Postman</creator> <location>cachingplugin.php?getpas=song1.mp3</location> <info>http://www.jeroenwijering.com</info> </track>   <track> <title>Jazzalude</title> <creator>Basement Jaxx</creator> <location>cachingplugin.php?getpas=song2.mp3</location> </track>   <track> <title>Homeland</title> <creator>Postman</creator> <location>cachingplugin.php?getpas=song1.mp3</location> </track>   </trackList> </playlist>


QUESTIONS // FRAGEN:

MSN: heuri [at] hotmail.de
ICQ: 289021519
Mail: support [at] pa-s.de
About || Forum

Beachten Sie: Wir übernehmen keinerlei Haftung für irgendwelche Schäden, Ausfälle oder sonstigen Geschehnissen.
Alle Angaben sind ohne Gewähr, Sie handeln auf eigenes Risiko!
Alle genannten Soft- und Hardwarebezeichnungen sowie Markennamen sind Eigentum ihrer jeweiligen Inhaber und unterliegen im Allgemeinen warenzeichen-, marken- oder patentrechtlichem Schutz.
Alle Rechte vorbehalten