Ok so my Mp3 download plays the same song twice : merges the Mp3 into a single, double-sized file. I am baffled.
<?php
if ($_GET[download] == 1) {
header("Content-type: application/MP3\n");
header("Content-disposition: attachment;filename=\"$_GET[name].mp3\"\n");
}
session_start();
include 'config.php';
if ($_GET[download] == 1) {
$SQL = "SELECT * from SALES WHERE ID = '$_GET[id]'"; $result = @mysql_query( $SQL ); $row = @mysql_fetch_array( $result );
$downloads = $row[DOWNLOADS] + 1;
$file_url = "http://www.mydomain.com/songs/$_GET[attach]/$_GET[append]_hifi.mp3";
readfile($file_url);
$sql = "UPDATE SALES SET DOWNLOADS = '$downloads' WHERE ID = '$_GET[id]'";
$query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error());
}
?>