Old 04-08-2008   #1 (permalink)
NewYork
 
pbcmedia's Avatar
 
Join Date: Mar 2007
Location: bk, ny
Posts: 21

Send a message via AIM to pbcmedia
Angry PHP Help

HELP.... im trying to do a random track playing playlist for this site that im doing and im having serious trouble with this php code....im getting an error when i test it saying theres something undefined in line 3...... all my mp3 tracks are on the server and so is the playlist(all in the same folder)... does any1 on here know programming to the point where u might be able to figure this out, can u atleast point me n the right direction??? PLEASE HELP ME



<?php
$playlist = "c:\sites\single39\holloywood\webroot\gudlyfeplayl ist.m3u";
if ($_SERVER['PATH_INFO'] == "gudlyfeplaylist.m3u") {
# 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($playlist);
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="c:\sites\single39\holloywood\webroot\gudlyfep laylist.m3u"
width="200"
height="25"
autostart="true"
type="audio/mpeg"
loop="true"/>
</body>
</html>
pbcmedia is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-09-2008   #2 (permalink)
Registered User
 
Join Date: Aug 2004
Posts: 105

You're using PATH_INFO incorrectly

PHP: pathinfo - Manual
Jolt is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 09:25 PM.
Content Relevant URLs by vBSEO 3.2.0 RC7

Design & Content © BioRUST 2007 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT