Index.php
<?php
$site = $_SERVER['HTTP_HOST'];
$dir_name = dirname($_SERVER['PHP_SELF']);
$current_url = "http://$site$dir_name/";
$asx = "asx.php";
$radio = new szsystem(''.$current_url.''.$asx.''); //URL e caminho do (asx.php)//
class szsystem {
var $attribs;
function __construct($src) {
//$this->attrib('pluginspage','http://www.microsoft.com/Windows/MediaPlayer/');
//uncomment line above when really needed
$this->attrib('type','application/x-mplayer2');
$this->attrib('width','468');
$this->attrib('height','60');
$this->attrib('loop','False');
$this->attrib('autostart','True');
$this->attrib('showstatusbar','false');
$this->attrib('volume','80');
$this->attrib('src',$src);
}
function attrib($name, $value) {
$this->attribs[$name] = $value;
}
function __toString() {
foreach($this->attribs as $name => $value) {
$tmp .= " $name='$value'";
}
return "<embed$tmp></embed>";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="somzuada" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HG SISTEMAS</title>
<style type="text/css">
<!--
body,td,th {
font-family: Georgia, Times New Roman, Times, serif;
}
-->
</style></head>
<body>
<center>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p>
<?=$radio?>
</p>
<p> </p>
<p> </p>
</center>
</body>
</html>
asx.php
<?php
header("Content-Type: audio/x-ms-asf");
header("Content-Disposition: filename=radio.asx");
header("Pragma: no-cache");
header("Cache: no-cache");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
$site = $_SERVER['HTTP_HOST'];
$dir_name = dirname($_SERVER['PHP_SELF']);
$current_url = "http://$site$dir_name/";
$dir = 'musicas'; //Pasta das musicas//
$url = ''.$current_url.''.$dir.'';
$ext = array('mp3', 'wma'); //Extenções de áudio permitidas//
$files = array();
foreach(new DirectoryIterator($dir) as $item) {
if($item->isFile() && in_array(strtolower(substr($item, -3)), $ext)) {
$files[] = "$url/$item";
}
}
mt_srand((double)microtime()*1000000); //randoniza as musicas//
shuffle($files);
print join("\n", $files);
?>
Não esqueça da pasta (musicas)