pbcmedia Posted April 10, 2008 Share Posted April 10, 2008 1. im trying to make the songs play randomly from my playlist on this site im building..... this is the error code that i get when i test the php pg from the server. 2. do i put the php code on the html pgs throughout the site or do i change the html pgs to php pgs and drop the php code on all the pgs????? Notice: Undefined index: PATH_INFO in C:\Sites\Single39\holloywood\webroot\gudlyfeRandom.php on line 3 can someone please help me, PLEASE <?php $playlist = "c:\sites\single39\holloywood\webroot\gudlyfe_playlist.m3u"; if ($_SERVER['PATH_INFO'] == "\gudlyfe_playlist.m3u") { <---------- line with error # This a request for the actual playlist. playlist(); } else { # Fall through to end of script and display # the player HTML. } function playlist() { header("Content-type: audio/mpeg"); # Needed for PHP versions OLDER than 4.2.0 only. # If your host still has PHP older than 4.2.0, shame on them. # Find a better web host. srand(make_seed()); # Fetch our list of songs from a file. $songs = file(gudlyfe_playlist.m3u); shuffle($songs); # Now output the URLs in random order. foreach ($songs as $song) { # Remove newline and any other leading and trailing # whitespace from URL of song. $song = trim($song); echo "$song\n"; } # Now exit before any HTML is produced. exit(0); } # Needed only for very old versions of PHP, # see srand call earlier. function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } ?> <html> <head> <title>MP3s Playing in Random Order</title> </head> <body> <h1 align="center">MP3s Playing in Random Order</h1> <embed src="http://holloywood.brinkster.net/gudlyfe_playlist.m3u" width="0" height="0" autostart="true" type="audio/mpeg" loop="true"/> </body> </html> Link to comment https://forums.phpfreaks.com/topic/100431-need-help-w-this-codeplease1/ Share on other sites More sharing options...
awpti Posted April 10, 2008 Share Posted April 10, 2008 Safe to ignore. It's a warning, not fatal. You could just drop the code into any .php file and it should work. Link to comment https://forums.phpfreaks.com/topic/100431-need-help-w-this-codeplease1/#findComment-513598 Share on other sites More sharing options...
pbcmedia Posted April 10, 2008 Author Share Posted April 10, 2008 Safe to ignore. It's a warning, not fatal. You could just drop the code into any .php file and it should work. do i have to change the html files to .php Link to comment https://forums.phpfreaks.com/topic/100431-need-help-w-this-codeplease1/#findComment-513603 Share on other sites More sharing options...
uniflare Posted April 10, 2008 Share Posted April 10, 2008 Safe to ignore. It's a warning, not fatal. You could just drop the code into any .php file and it should work. do i have to change the html files to .php no. all you need to do to get rid of this notice is change the line to: if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] == "\gudlyfe_playlist.m3u") { -- i wouldn't use PATH_INFO, as its not compatible with certain server configurations, there must be an easier safer way, what are you using it for? Link to comment https://forums.phpfreaks.com/topic/100431-need-help-w-this-codeplease1/#findComment-513632 Share on other sites More sharing options...
uniflare Posted April 10, 2008 Share Posted April 10, 2008 . do i put the php code on the html pgs throughout the site or do i change the html pgs to php pgs and drop the php code on all the pgs? what do you mean? you currently have html pages and what to use php on every page (like add this snippet)? you will need to change every page that uses php to a .php extension unless the server has been configured otherwise. Link to comment https://forums.phpfreaks.com/topic/100431-need-help-w-this-codeplease1/#findComment-513633 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.