Downloads not working in IE
I've encountered a bit of a problem with my digital download store.
I have a page that a customer can log into to get their MP3 files from, which used DFP2. It works fine in Mac Safari/Firefox and Win/Firefox, but not in Win/IE, although it did work originally!!
In IE once you click the download button the pop up appears, but it seems to be trying to do download the orderdetails.php page and not the MP3 file (screenshot attached)!!!
Here is my PHP code:
<?php require_once('../Connections/connHeckie.php'); ?>
<?php require_once( "../WA_SecurityAssist/Helper_PHP.php" ); ?>
<?php require_once("../WA_DigitalFilePro/HelperPHP.php"); ?>
<?php
//WA eCart Include
require_once("../WA_eCart/MacmeanmnaCart_PHP.php");
?>
<?php
$MacmeanmnaCart->GetContent();
?>
<?php
if (!WA_Auth_RulePasses("Logged in to visitors")){
WA_Auth_RestrictAccess("login.php");
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
?>
<?php
$maxRows_WADAmusic = 1000;
$pageNum_WADAmusic = 0;
if (isset($_GET['pageNum_WADAmusic'])) {
$pageNum_WADAmusic = $_GET['pageNum_WADAmusic'];
}
$startRow_WADAmusic = $pageNum_WADAmusic * $maxRows_WADAmusic;
$colname_WADAmusic = "-1";
if (isset($_GET['ID'])) {
$colname_WADAmusic = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_connHeckie, $connHeckie);
$query_WADAmusic = sprintf("SELECT * FROM orderdetails WHERE DetailOrderID = %s AND DetailType = 1 AND DetailDownload < 1 ORDER BY DetailItemName ASC", GetSQLValueString($colname_WADAmusic, "int"));
$query_limit_WADAmusic = sprintf("%s LIMIT %d, %d", $query_WADAmusic, $startRow_WADAmusic, $maxRows_WADAmusic);
$WADAmusic = mysql_query($query_limit_WADAmusic, $connHeckie) or die(mysql_error());
$row_WADAmusic = mysql_fetch_assoc($WADAmusic);
if (isset($_GET['totalRows_WADAmusic'])) {
$totalRows_WADAmusic = $_GET['totalRows_WADAmusic'];
} else {
$all_WADAmusic = mysql_query($query_WADAmusic);
$totalRows_WADAmusic = mysql_num_rows($all_WADAmusic);
}
$totalPages_WADAmusic = ceil($totalRows_WADAmusic/$maxRows_WADAmusic)-1;
$colname_rsOrder = "-1";
if (isset($_GET['ID'])) {
$colname_rsOrder = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_connHeckie, $connHeckie);
$query_rsOrder = sprintf("SELECT *, DATE_FORMAT(OrderDate, '%%W %%D %%M %%Y') as OrderDate FROM orders WHERE OrderID = %s", GetSQLValueString($colname_rsOrder, "int"));
$rsOrder = mysql_query($query_rsOrder, $connHeckie) or die(mysql_error());
$row_rsOrder = mysql_fetch_assoc($rsOrder);
$totalRows_rsOrder = mysql_num_rows($rsOrder);
$colname_WADAbooks = "-1";
if (isset($_GET['ID'])) {
$colname_WADAbooks = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_connHeckie, $connHeckie);
$query_WADAbooks = sprintf("SELECT * FROM orderdetails WHERE DetailOrderID = %s AND DetailType = 2 ORDER BY DetailItemName ASC", GetSQLValueString($colname_WADAbooks, "int"));
$WADAbooks = mysql_query($query_WADAbooks, $connHeckie) or die(mysql_error());
$row_WADAbooks = mysql_fetch_assoc($WADAbooks);
$totalRows_WADAbooks = mysql_num_rows($WADAbooks);
$colname_WADAmusicexpired = "-1";
if (isset($_GET['ID'])) {
$colname_WADAmusicexpired = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_connHeckie, $connHeckie);
$query_WADAmusicexpired = sprintf("SELECT * FROM orderdetails WHERE DetailOrderID = %s AND DetailType = 1 AND DetailDownload = 1 ORDER BY DetailItemName ASC", GetSQLValueString($colname_WADAmusicexpired, "int"));
$WADAmusicexpired = mysql_query($query_WADAmusicexpired, $connHeckie) or die(mysql_error());
$row_WADAmusicexpired = mysql_fetch_assoc($WADAmusicexpired);
$totalRows_WADAmusicexpired = mysql_num_rows($WADAmusicexpired);
$colname_rsDownloadFile = "-1";
if (isset($_POST['fileID'])) {
$colname_rsDownloadFile = (get_magic_quotes_gpc()) ? $_POST['fileID'] : addslashes($_POST['fileID']);
}
mysql_select_db($database_connHeckie, $connHeckie);
$query_rsDownloadFile = sprintf("SELECT * FROM orderdetails WHERE DetailsID = %s", GetSQLValueString($colname_rsDownloadFile, "int"));
$rsDownloadFile = mysql_query($query_rsDownloadFile, $connHeckie) or die(mysql_error());
$row_rsDownloadFile = mysql_fetch_assoc($rsDownloadFile);
$totalRows_rsDownloadFile = mysql_num_rows($rsDownloadFile);
mysql_select_db($database_connHeckie, $connHeckie);
$query_rsStatus = "SELECT StatusLabel FROM orderstatustypes, orders WHERE (orderstatustypes.StatusID = orders.OrderStatus)";
$rsStatus = mysql_query($query_rsStatus, $connHeckie) or die(mysql_error());
$row_rsStatus = mysql_fetch_assoc($rsStatus);
$totalRows_rsStatus = mysql_num_rows($rsStatus);
?>
<?php
WA_DFP_SetupDownloadStatusStruct("WA_DownloadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_DownloadFile("WA_DownloadResult1", "../../downloads/", "".$row_rsDownloadFile['DetailDownloadFile'] ."", "[FileName]", 1, $database_connHeckie, $connHeckie, "orderdetails", "DetailsID", "".$row_WADAmusic['DetailsID'] ."", "DetailDownload");
}
?>
<?php
$queryString_WADAmusic = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_WADAmusic") == false &&
stristr($param, "totalRows_WADAmusic") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_WADAmusic = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_WADAmusic = sprintf("&totalRows_WADAmusic=%d%s", $totalRows_WADAmusic, $queryString_WADAmusic);
?>
<?php
// WA eCart Redirect
if ($MacmeanmnaCart->redirStr != "") {
header("Location: ".$MacmeanmnaCart->redirStr);
}
?>
and the form with the download button:
<form method="post" name="downloadform<?php echo $row_WADAmusic['DetailsID']; ?>" id="downloadform<?php echo $row_WADAmusic['DetailsID']; ?>">
<input name="download<?php echo $row_WADAmusic['DetailsID']; ?>" type="image" id="download<?php echo $row_WADAmusic['DetailsID']; ?>" onclick="MM_callJS('setTimeout(\'document.location.href=document.location.href\',1000)')" value="Download" src="../images/design/download.gif" alt="Download"/>
<input name="fileID" type="hidden" value="<?php echo $row_WADAmusic['DetailsID']; ?>" />
</form>