rolanduk2014 Posted May 22, 2013 Share Posted May 22, 2013 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> Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted May 22, 2013 Share Posted May 22, 2013 I can't work out what your logic is trying to check against but your problem is clearly that $row['converted'] is never equal to 1. Have you properly verified the data being returned from the query is accurate to what you are looking for? Quote Link to comment Share on other sites More sharing options...
rolanduk2014 Posted May 22, 2013 Author Share Posted May 22, 2013 If i remove line 15-16 and line 37 38 39 40 41 42, then its fine the page not redirecting, but then an automatic window pop up to download the file called get.php Which is contain the code pasted above. If i can make sure the automatic donwload ot start then it will work Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.