mySQLSafe(base64_decode($_GET['oid']))." AND ".$glob['dbprefix']."CubeCart_Downloads.productId = ".$db->mySQLSafe($_GET['pid'])." AND accessKey = ".$db->mySQLSafe($_GET['ak'])." AND noDownloads<".$config['dnLoadTimes']." AND expire>".time(); $download = $db->select($query); if ($download) { if (eregi("ftp://",$download[0]['digitalDir']) || eregi("http://",$download[0]['digitalDir']) || eregi("https://",$download[0]['digitalDir'])) { $record['noDownloads'] = "noDownloads + 1"; $where = "cart_order_id = ".$db->mySQLSafe(base64_decode($_GET['oid']))." AND productId = ".$db->mySQLSafe($_GET['pid'])." AND accessKey = ".$db->mySQLSafe($_GET['ak']); $update = $db->update($glob['dbprefix']."CubeCart_Downloads", $record, $where); httpredir($download[0]['digitalDir']); } else { $record['noDownloads'] = "noDownloads + 1"; $where = "cart_order_id = ".$db->mySQLSafe(base64_decode($_GET['oid']))." AND ".$glob['dbprefix']."CubeCart_Downloads.productId = ".$db->mySQLSafe($_GET['pid'])." AND accessKey = ".$db->mySQLSafe($_GET['ak']); $update = $db->update($glob['dbprefix']."CubeCart_Downloads", $record, $where); ## Close the session to allow for header() to be sent session_write_close(); if (deliverFile($download[0]['digitalDir'])) { exit; } else { die ("There was an error dowloading the file. Please contact a member of support for help."); } } } else { httpredir("index.php?_g=co&_a=error&code=10002"); } ?>