Hy All
Im here again to ask for you help. I still in the begining to launch the site, and i found a major error. The theory is the following. I planning to start a Pay per download site, which mean the members upload a file and when somebody want to download it, they have to fill a short survey. After survey done, both me and them get money. The problem is i test the script, and when i open the donwload link http://www.filemonster.org/download.php?id=11 the page load, then immediately redirect and i get a following error "Stop trying to download without completing a survey." which is an anti cheat message. Its 100% wrong because its appears all the time. i paste here the code, do you know why its appear straight after the page load? Its just appear for me on the Firefox.
<?php
ob_start();
session_start();
include_once('secure/core.php');
if (!isset($_GET['extra'])){
echo '<script type="text/javascript">alert("Invalid access.");</script>';
die();
}
$path = $settings->getUploadPath();
$rand = mysql_real_escape_string($_GET['rand']);
$sql = "SELECT * FROM `conversions` WHERE `rand` = '$rand' and `converted` = '1'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$file = $row['file_id'];
if($row['converted'] == '1') {
if($row['downloaded'] == '0') {
$path = $settings->getUploadPath();
$sql5 = "select * from `uploads` where `id` = '$file'";
$row5 = $ado->fetch($ado->exec($sql5));
$sql6 = "UPDATE `conversions` SET `downloaded` = '1' WHERE `rand` = '$rand'";
$ado->exec($sql6);
set_time_limit(0);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=\"".$row5['hash']."\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($path.$row5['hash']));
ob_end_flush();
@readfile($path.$row5['hash']);
exit(0);
} else {
echo '<script type="text/javascript">alert("You have already downloaded this.");</script>';
}
} else {
echo '<script type="text/javascript">alert("Stop trying to download without completing a survey.");</script>';
}
?>
<script type="text/javascript">
$('#myModal').modal('hide');
</script>
Please if any of you have an idea, share with me