Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Script: Php Jukebox, A one file script!
cragllo
post May 17 2005, 05:21 PM
Post #1


Sorry for not being active, Uni :(
*********

Group: Members
Posts: 933
Joined: 24-August 04
From: South Wales, UK
Member No.: 892



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, I 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:     http://www.cragllo.com/
* 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>

After you have created that file, upload it and make a folder in the same folder as the file is in called 'songs', and just upload a few mp3's to the 'songs' folder!

Thats it, your done, if you need any more help or have a question, simple reply here.

Thanks,
Craig.

This post has been edited by cragllo: Jul 15 2006, 07:29 PM
Go to the top of the page
 
+Quote Post
badinfluence
post May 17 2005, 06:43 PM
Post #2


Super Member
*********

Group: Members
Posts: 283
Joined: 10-October 04
Member No.: 1,637



hello cargllo,
it's nice script.. i found something similar before but which run with mx-system(phpbb powered portal system). i gotta one question,
if i host my song files on other host server(which is more about good to stream bandwidth), how this script can tweak to link that file..it's something like off-site avatar setting....
is it just simply change the path??

CODE
<embed src="songs/<?=$song;?>"
to
CODE
<embed src="off-site songs link/<?=$song;?>"
Go to the top of the page
 
+Quote Post
cragllo
post May 17 2005, 09:07 PM
Post #3


Sorry for not being active, Uni :(
*********

Group: Members
Posts: 933
Joined: 24-August 04
From: South Wales, UK
Member No.: 892



Yes, you just change the little bit...
CODE
<embed src="http://www.othersite.com/if_in_folder/<?=$song;?>

its as simple as that wink.gif

This post has been edited by cragllo: May 17 2005, 09:08 PM
Go to the top of the page
 
+Quote Post
iGuest
post Mar 30 2008, 09:22 AM
Post #4


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



Can you kindly suggest me a simple Jukebox to streem music on my website?
Script: Php Jukebox

Can you kindly suggest me a simple Jukebox to streem music on my website?

-reply by Sreenivas
Go to the top of the page
 
+Quote Post
iGuest
post May 3 2008, 09:31 AM
Post #5


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



need help with WMA
Script: Php Jukebox

I like this script you did a great job on it, just one thing though is there some how I can edit it or you can to play WMA files along with mp3?

-question by Mitch
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Getting List Of Directories And Files Using Php(6)
  2. Parse: Error Unexpected T_lnumber(4)
  3. Transfer Variables To Another Php Script(8)
  4. Include File.php?id=something(13)
  5. Watermark Your Image With Simple Php Script(34)
  6. Wappychat_oldskool(15)
  7. Free Auction Script(6)
  8. Wappy Buddy V1.10 - Tibia Gold Edition By Wappy & Jon Roig(3)
  9. What Kind Of Script Do You Need ?(15)
  10. Creatting A Playlist Through Php(5)
  11. Html Code Tester. Online Script(15)
  12. Will This Code Work(5)
  13. Php Downloads Script(3)
  14. Script Help Required: Undefined Variable(3)
  15. Script Not Working(6)
  1. Library Script(6)
  2. How Would I Go About Making A Simple "counting" Script?(3)
  3. Forum Script(3)
  4. Php Rediret Script(12)
  5. Download Script For Mp3 Files(0)
  6. Updating Php File Through A Web Form(5)
  7. How Do I Connect To Live Database With Php Script?(6)
  8. Need Some Help In File Browser(8)
  9. Need Help Installing Dolphin Community Script!(5)
  10. Php Configuration File(16)
  11. Guessing Php Script(0)
  12. How To Make A View New Post Script?(5)
  13. Php Guest Online Script(0)


 



- Lo-Fi Version Time is now: 24th July 2008 - 12:29 PM