'ello all.
I am trying to get a MySQL DB table to update when a file is downloaded.
The problem is that when the page is accessed by link the DB does not update, but when the page is accessed directly, everything works as it should.
Any ideas?
Here is the entire script.
<?php
session_start();
require_once('/home/xxxxxx/public_html/includes.php');
require_once('/home/xxxxxx/public_html/pager.php');
if(!$PAGEVARS[0] || !$PAGEVARS[1]) die('Oh no, you upset the server!');
$ip = ($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
$browser = $_SERVER['HTTP_USER_AGENT'];
$file = $PAGEVARS[0];
$ext = $PAGEVARS[1];
if($ext == 'ZIP'){
$user->query("INSERT INTO downloads VALUES ('', '$file', '$ext', '$ip', NOW(), '$browser')");
header('Content-type: application/x-zip-compressed');
header('Content-Disposition: attachment; filename="sDealer-'.$file.'.zip"');
readfile('/home/xxxxxx/public_html/downloads/'.$file.'.zip');
} elseif($ext == 'TAR') {
$user->query("INSERT INTO downloads VALUES ('', '$file', '$ext', '$ip', NOW(), '$browser')");
header('Content-type: application/x-gzip');
header('Content-Disposition: attachment; filename="sDealer-'.$file.'.tar.gz"');
readfile('/home/xxxxxx/public_html/downloads/'.$file.'.tar.gz');
}
?>