Please tell me what’s wrong with this setup, it simply won’t work. My database is fine as far as I know.
Index.php
[code]
[/code]playlist.xml
[code]<?xml version=”1.0? encoding=”UTF-8??>
[/code]
mp3.php
[php]<?php
if (! preg_match(’/^[-a-z.-@,‘s]*$/i’,$_GET[‘ID’]))
{
die(‘No illegal characters’);
}
else
$empty=strlen($_GET[‘ID’]);
if ($empty==0)
{
die(‘The text field cannot be empty’);
}
else
{
$ID = $_GET[‘ID’];
}
$username = “m7219520”;
$password = “filtered out”;
$hostname = “filtered out”;
$database = “filtered out”;
$dbhandle = mysql_connect($hostname, $username, $password)
or die(“Unable to connect to MySQL”);
$selected = mysql_select_db($database,$dbhandle)
or die(“Could not select $database”);
$ID = mysql_real_escape_string(stripslashes($ID));
$result = mysql_query(“SELECT Real URL
FROM MP3
WHERE ID
=’$ID’”)
or die(mysql_error());
$row = mysql_fetch_array( $result )
or die("Invalid query: " . mysql_error());
$direction = $row[‘URL’];
$path=‘http://’.$direction;
header(‘Content-type: audio/mpeg’);
header('Content-Length: '.filesize($path)); // provide file size
header(“Expires: -1”);
header(“Cache-Control: no-store, no-cache, must-revalidate”);
header(“Cache-Control: post-check=0, pre-check=0”, false);
readfile($path);
mysql_close($dbhandle);
?>[/php]