Jump to content

Src Problem. Why? I Cant Figure It Out.


sweinkauf13
 Share

Recommended Posts

Ok, so first off i'd like to say im srry for not being a big part of the board during the last few months. With school and sports I did not do very much free time things on the computer. ok sooo anyway. Here is what i'm workin on...I'M makin a little project to play music. It's not a very complicated idea. But here is my problem. when play_media.php gets the song path it doesnt play anything (the player(when play is clicked) plays nothing). altho i've tested the paths and they lead to the song files. A side note for that, its only when the play_media.php script gets a full path (when it gets a complete path to the songs on my hard drive.) and not when it goes and gets it from the database. here are the files:[select_song_step1.php]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>LiveMP3!</title><link rel="stylesheet" type="text/css" href="style.css"></head><body>	<div class="ipod"><hr color="white">		<div class="song_list"><p>Song List:</p><?$connection = @mysql_connect("localhost",'user','pass') or die(mysql_error());#$database = "livemp3";$tablename = "music";#$db = @mysql_select_db($database, $connection) or die(mysql_error());$sql = "select * from $tablename";$result = @mysql_query($sql, $connection) or die(mysql_error());#$table = "<p><table cellspacing=5 cellpadding=5 class=\"arcade\">";#while ($row = mysql_fetch_array($result)){$id = $row['id'];$dm = $row['display_name'];#$table .= "<tr><td><a href=\"play_media.php?song=$id\">$dm</a></th></tr>";}$table .= "</table></p>";#echo "$table";#?><hr color="white"><p>Or to get a song from your computer type in it's location below and it will play:</p>	<form method="post" action="play_media.php"><p><input type="text" name="song_url" size="25"></p><p align="right"><input type="submit" value="Play"></p>	</form><hr color="white">		</div>	</div>	<div class="info_box"><h3><p>Menu:</p></h3><p><a href="index.php">Go to Homepage</a></p><p><a href="main.php">Go back to media selection page</a></p>	</div></body></html>

[play_media.php]

<?$song = "$_GET[song]";if($song != ""){$connection = @mysql_connect("localhost",'user','pass') or die(mysql_error());#$database = "livemp3";$tablename = "music";#$db = @mysql_select_db($database, $connection) or die(mysql_error());$sql = "select * from $tablename where id = $song";$result = @mysql_query($sql, $connection) or die(mysql_error());##$row = mysql_fetch_array($result);$fn = $row['file_name'];# add full string to $fn$file_name = "music/$fn";$file_size = $row['file_size'];$dn = $row['display_name'];$artist = $row['artist'];$length = $row['length'];}?><?$song = "$_GET[song]";if($song == ""){#$na = "Unknown";#require("defults.inc");$fn = "$_POST[song_url]";$fn = stripslashes("$fn");$file_name = "$music_domain\\$fn";$file_size = "$na";$dn = "$na";$artist = "$na";$length = "$na";}?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>LiveMP3!</title><link rel="stylesheet" type="text/css" href="style.css"></head><body>	<div class="ipod"><hr color="white">	<!-- Start Player --><embed id="player" Controls="smallconsole"height="280" width="195" src="<? echo("$file_name"); ?>" autostart="false"></p>	</div>	<div class="info_box"><h2><p>Song Information:</p></h2><p><b><? echo("$dn"); ?> by <? echo("$artist"); ?></b></p><p>Song Size: <? echo("$file_size"); ?></p><p>Song Length: <? echo("$length"); ?></p><p><a href="main.php">Back</a></p>	</div></body></html>

Ok. some things i'm quickly going to go over:in play_media.php:

require("defults.inc");$fn = "$_POST[song_url]";$fn = stripslashes("$fn");$file_name = "$music_domain\\$fn";

about:here I have taken the defult path to the folder on my hard drive called My Music (basic windows folder) to avoid having to type it in. the url is turning out fine from this. The url to the songs are complete.One last thing i will post is my play_media.php after a submission:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>LiveMP3!</title><link rel="stylesheet" type="text/css" href="style.css"></head><body>	<div class="ipod"><hr color="white">	<!-- Start Player --><p><embed id="player" Controls="smallconsole"height="280" width="195" src="C:\Documents and Settings\Profile Name\My Documents\My Music\artist\music_file.wma" autostart="false"></p>	</div> 	<div class="info_box"><h2><p>Song Information:</p></h2><p><b>Unknown by Unknown</b></p><p>Song Size: Unknown</p><p>Song Length: Unknown</p><p><a href="main.php">Back</a></p>	</div></body></html>

again real quickly here is one thing i'd like to point out:

	<div class="ipod"><hr color="white">	<!-- Start Player --><p><embed id="player" Controls="smallconsole"height="280" width="195" src="C:\Documents and Settings\Profile Name\My Documents\My Music\artist\music_file.wma" autostart="false"></p>	</div>

here I've changed the url a bit as not to give a way information. So some place holders were used in this example.Ok. so here is everything related to this issue as far as I know. If more information / scripts are required please let me know. Thanks in advance,Youngwebmaster

Link to comment
Share on other sites

You probably need to give the source an actual URL, i.e. something starting with a scheme ("file://") instead of just a path. Even so, test this with Firebug and check under the Net console to see the request go out for the file, you should see some sort of status information like the request was OK, or not found, or whatever.

Link to comment
Share on other sites

ok disregard that last post. Ok here are the errors the IE debugger gave me:Converting backslash in URI to slashEscaping malformed URI reference

Link to comment
Share on other sites

Firebug is a debugging extension for Firefox. Among other things, you can use it to look at requests going out and what the response was. That's what you need to look at. If you want to use IE for debugging, download Fiddler and install that to look at the requests and responses.

Link to comment
Share on other sites

Ok I have now downloaded fiddler. I ran the script and it came up in the fiddler program. It was in red. But im not sure how to use the fiddler program to help me with my error.

Link to comment
Share on other sites

Look at the response from the request and try to find information about the error, look for an error code or something like that. Click on the request and then click the Inspectors tab, and then in the top right you'll see information about the request, and the bottom right you'll see information about the response. You should be looking for information in the Headers and TextView tabs.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...