[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

problem with readfile()

Posted on 2011-05-11
8
Medium Priority
?
495 Views
Last Modified: 2012-05-11
hello!

there is this SWF object, just a small mp3 player.


<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550" height="20" id="FlashID" title="player">
	<param name="movie" value="player.swf" />
	<param name="FlashVars" value="configxml=player.xml&amp;mp3=soundfetcher.php?<? echo "fn=".$fileid."&con=".$control."&con1=".$referer; ?>" />
	<param name="quality" value="high" />
	<param name="wmode" value="transparent" />
	<param name="swfversion" value="7.0.70.0" />
	<param name="expressinstall" value="assets/expressInstall.swf" />
		<object type="application/x-shockwave-flash" data="player.swf" width="550" height="20">
		<param name="FlashVars" value="configxml=player	.xml&amp;mp3=soundfetcher.php?<? echo "fn=".$fileid."&con=".$control."&con1=".$referer; ?>" />
		<param name="quality" value="high" />
		<param name="wmode" value="transparent" />
		<param name="swfversion" value="7.0.70.0" />
		<param name="expressinstall" value="assets/expressInstall.swf" />
		<div><h4>Content on this page requires a newer version of Adobe Flash Player.</h4><p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p></div>
		</object>
	</object>

Open in new window



please take note that the MP3 file is not hard coded, but called from another php file.
essentially that php file "soundfetcher.php" contains some authentication codes and finally a readfile()

header('Content-type: audio/mpeg');
header('X-Pad: avoid browser bug');
header('Cache-Control: no-cache');

if ($okfinal==3) {readfile('something.mp3');};

Open in new window



this readfile() is just outputting the contents of the mp3 file into the code.
naturally, that doesn't work.

so my question is what command should i use to replace the readfile() so that the player works??

my knowledge of php is very limited, so if you are explaining someting, explain as if you were doing it to a 10 year old :)
also, if you need any more info that will help you solve this issue, please ask.


thanks,
hathehariken.
player.swf
player.xml
0
Comment
Question by:hathehariken
  • 5
  • 3
8 Comments
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 2000 total points
ID: 35737218
What if you add this:

header('Content-Transfer-Encoding: binary');
in here:
header('Content-type: audio/mpeg');
header('X-Pad: avoid browser bug');
header('Cache-Control: no-cache');
0
 
LVL 27

Expert Comment

by:Lukasz Chmielewski
ID: 35737223
0
 
LVL 12

Author Comment

by:hathehariken
ID: 35737307
it works!!!

header('Content-Transfer-Encoding: binary');
header('Content-type: audio/mpeg');
header('X-Pad: avoid browser bug');
header('Cache-Control: no-cache');

Open in new window


you are simply a genius!
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 27

Expert Comment

by:Lukasz Chmielewski
ID: 35737320
Happy listening.
0
 
LVL 12

Author Comment

by:hathehariken
ID: 35737322
i do have one more small question, if you dont mind.
can you point me a place where there are lots of flash mp3 players to choose from?
0
 
LVL 27

Expert Comment

by:Lukasz Chmielewski
ID: 35737353
As it is not my area the only thing I can point you to is to google it :/
It would be rude to just paste the link to "mp3 flash player" or "freeware mp3 flash player" so, give it a go.
0
 
LVL 12

Author Comment

by:hathehariken
ID: 35737357
:)

okay then!
thanx again...
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month20 days, 4 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question