View Full Version : web thingy

02-25-2004, 04:11 PM
basically I am not into web but all out there also have some exp

this is what I want

can anybody help me out in this
i have few songs in my website and i want the viewer to select the song from the list and play. the format being *.wma. i want the viewer CLICK AND PLAY functionality without prompting him to select the player and the option SAVE THE FILE TO DISK or PLAY FROM CURRENT LOCATION.

basically it should play the file in windows media player from the browser itself

can anybody thro some light as to how to do it

reuben:cry: :cry:

02-25-2004, 06:05 PM
sure. You would treat those the same as any standard hyperlink:

<a href="" alt="My Song Title Goes Here">The song link name</a>
<a href="" alt="My Song Title Goes Here">The song link name</a>
<a href="" alt="My Song Title Goes Here">The song link name</a>

03-02-2004, 10:16 AM
Well here is a little nifty file lister:


// specify the directory you wish to list

$directory = "./songs/";

// specify the URL to the files, WITH ending / besure to include the directory on the end, since this is used for linking
$prefixurl = "";


echo "<head>";
echo "<title>DJMirage file lister</title>";
echo "</head>";
echo "<body bgcolor='#ffffff'>";
echo "<table border='1px' bordercolor='#63cfff' cellspacing='1px' cellpadding='5px' bgcolor='#63cfff' width='95%'>";
echo "<tr bgcolor='#F0F1DA'><td bgcolor='#ffffff'>Songs: (.wma)</td><td bgcolor='#ffffff' width='90px'>File:</td><td bgcolor='#ffffff' width='50px'>Filesize:</td><td bgcolor='#ffffff' width='110px'>Online since:</td></tr>";

function file_size($bestand){
$size = filesize($bestand);
$type = 'bytes';
if ($size > '1023'){$size = $size/1024;$type = 'KB';}
if ($size > '1023'){$size = $size/1024;$type = 'MB';}
if ($size > '1023'){$size = $size/1024;$type = 'GB';}
if ($size > '1023'){$size = $size/1024;$type = 'TB';}
if ($size < '10') $size = intval($size*100)/100;else if ($size < '100') $size = intval($size*10)/10;else $size = intval($size);
#$size = str_replace(".", ",", $size);
return "$size $type";

$handle = opendir($directory);

while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && substr($file, 0, 1) != ".") {
// if you need the file type, here it is!
$type = substr($file, strpos($file, ".") + 1, strlen($file) - strpos($file, "."));
$extensie = substr($file, strpos($file, ".") + 1, strlen($file) - strpos($file, "."));
$keepremove = 'EMPTY';
if ($type == 'wma'){$keepremove = 'KEEP';$type='Windows Media';}
if ($keepremove != 'KEEP'){$keepremove = 'REMOVE';}
if ($keepremove == 'REMOVE'){$color = '#FAF1DA';}
if ($keepremove == 'KEEP'){$color = '#F0F1DA';}

// this is to change weird letters into url friendly format
$uh = array("&" => "%26");
$wsfile = strtr($file, $uh);
$grootte = file_size("$directory$file");
$filemod = filemtime("$directory$file");
$filemodtime = date("j F, Y", $filemod);
$file2 = basename($file, ".wma");
$uh = array("-" => " ");
$file3 = strtr($file2, $uh);
$uh = array("_" => " ");
$file4 = strtr($file3, $uh);
if ($extensie == 'wma'){echo "<tr bgcolor='$color'><td bgcolor='$color'><a href=\"$prefixurl$wsfile\">$file4</a></td><td bgcolor='$color'>$type</td><td bgcolor='$color'>$grootte</td><td bgcolor='$color'>$filemodtime</td></tr>\n";}
echo "</table>";
echo "</body>";


Now just put this file 1 directory lower then your songs directory.
Cheers :)

CGTalk Moderation
01-17-2006, 02:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.