i found this on another site...
This scripts is so simple, you dont need to edit ANY of it! All you have to do is make a folder called 'songs' and put some audio files in it.
Here is the whole page, Graig, the coder, named it index.php and put it in a folder called 'music':
CODE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>PHP jukebox</title>
</head>
<body>
<!--
©2005 Craig lloyd. All rights reserved.
Visit cragllo.com for more scripts
-->
<?php
/**
* ©2005 Craig lloyd. All rights reserved.
*
* Mod Title: Simple PHP Jukebox
* Author: Craig Lloyd
* Author Email: cragllo@cragllo.com
* Author Homepage: cragllo
* Description: A Simple Jukebox script to enable visitors to your site
* to choose a song from a given list and play that song.
* Release: v1.0, 17th May 2005
***
* Demo: None
* Installation Level: Easy
* Installation Time: 1 minute
* Files To Edit: None
* Included Files: index.php
* Included Folders: songs/
* ----------------------[ HOW TO INSTALL ]----------------------------
* Simply upload this file and create a folder called 'songs'
* Then just upload .mp3 files into the 'songs' folder
*
* Either show this page in an iframe or include it into any page
* If you include it, the page it is included in has to be in teh same
* folder as the songs folder!!
*/
//---------[ DO NOT EDIT UNLESS YOU KNOW WHAT YOU ARE DOING! ]---------
// Get information from form
$song = $_POST['song'];
$go = $_POST['go'];
if($go){
?>
<!-- Player Start -->
<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab" width="240" height="43">
<param name="FileName" value="songs/<?=$song;?>">
<param name="AutoStart" value="true">
<param name="ShowTracker" value="true">
<param name="ShowControls" value="true">
<param name="ShowGotoBar" value="false">
<param name="ShowDisplay" value="false">
<param name="ShowStatusBar" value="false">
<param name="AutoSize" value="false">
<param name="PlayCount" value="0">
<embed src="songs/<?=$song;?>" AutoStart="true" ShowTracker="true" ShowControls="true" PlayCount="0" ShowGotoBar="false" ShowDisplay="false" ShowStatusBar="false" AutoSize="false" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/" width="240" height="43"></embed>
</object>
<!-- Player End -->
<?php
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<select name="song">
<option value="#">Choose a song</option>
<!-- List Files Start -->
<?
$files = Array();
$path = "songs";
$dh = opendir($path);
while ($file = readdir($dh)) {
if (!is_dir($path."/".$file)) {
if (is_file($path."/".$file)) {
if (($file!=".") && ($file!="..")) {
$files[] = $file;
}
}
}
}
closedir($dh);
asort($files);
foreach($files as $index=>$file) {
echo "<option value=\"".$file."\">".$file."</option>\n";
}
?>
<!-- List Songs End -->
</select>
<input name="go" type="submit" value="PLAY!">
</form>
<span style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000;">©2005 Craig lloyd. All rights reserved. <a href="http://www.cragllo.com/" target="_blank">Cragllo.com</a></span>
</body>
</html>
i didnt try it out yet, am going to try it out later this evening, and post a demo
This scripts is so simple, you dont need to edit ANY of it! All you have to do is make a folder called 'songs' and put some audio files in it.
Here is the whole page, Graig, the coder, named it index.php and put it in a folder called 'music':
CODE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>PHP jukebox</title>
</head>
<body>
<!--
©2005 Craig lloyd. All rights reserved.
Visit cragllo.com for more scripts
-->
<?php
/**
* ©2005 Craig lloyd. All rights reserved.
*
* Mod Title: Simple PHP Jukebox
* Author: Craig Lloyd
* Author Email: cragllo@cragllo.com
* Author Homepage: cragllo
* Description: A Simple Jukebox script to enable visitors to your site
* to choose a song from a given list and play that song.
* Release: v1.0, 17th May 2005
***
* Demo: None
* Installation Level: Easy
* Installation Time: 1 minute
* Files To Edit: None
* Included Files: index.php
* Included Folders: songs/
* ----------------------[ HOW TO INSTALL ]----------------------------
* Simply upload this file and create a folder called 'songs'
* Then just upload .mp3 files into the 'songs' folder
*
* Either show this page in an iframe or include it into any page
* If you include it, the page it is included in has to be in teh same
* folder as the songs folder!!
*/
//---------[ DO NOT EDIT UNLESS YOU KNOW WHAT YOU ARE DOING! ]---------
// Get information from form
$song = $_POST['song'];
$go = $_POST['go'];
if($go){
?>
<!-- Player Start -->
<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab" width="240" height="43">
<param name="FileName" value="songs/<?=$song;?>">
<param name="AutoStart" value="true">
<param name="ShowTracker" value="true">
<param name="ShowControls" value="true">
<param name="ShowGotoBar" value="false">
<param name="ShowDisplay" value="false">
<param name="ShowStatusBar" value="false">
<param name="AutoSize" value="false">
<param name="PlayCount" value="0">
<embed src="songs/<?=$song;?>" AutoStart="true" ShowTracker="true" ShowControls="true" PlayCount="0" ShowGotoBar="false" ShowDisplay="false" ShowStatusBar="false" AutoSize="false" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/" width="240" height="43"></embed>
</object>
<!-- Player End -->
<?php
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<select name="song">
<option value="#">Choose a song</option>
<!-- List Files Start -->
<?
$files = Array();
$path = "songs";
$dh = opendir($path);
while ($file = readdir($dh)) {
if (!is_dir($path."/".$file)) {
if (is_file($path."/".$file)) {
if (($file!=".") && ($file!="..")) {
$files[] = $file;
}
}
}
}
closedir($dh);
asort($files);
foreach($files as $index=>$file) {
echo "<option value=\"".$file."\">".$file."</option>\n";
}
?>
<!-- List Songs End -->
</select>
<input name="go" type="submit" value="PLAY!">
</form>
<span style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000;">©2005 Craig lloyd. All rights reserved. <a href="http://www.cragllo.com/" target="_blank">Cragllo.com</a></span>
</body>
</html>
i didnt try it out yet, am going to try it out later this evening, and post a demo
Comment