/*
 $ip_addr = $_SERVER[REMOTE_ADDR];
 if($ip_addr == "::1")
     $ip_addr = "206.225.132.11";
 */
 $ip_addr = $_REQUEST['ip_addr'];
 //david
 $geoplugin = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip_addr));
 $url = 'http://www.geoplugin.net/php.gp?ip=' . $ip_addr;
 //$ch1 = curl_init();
 //curl_setopt($ch1, CURLOPT_URL, $url);
 //curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
 //$result = curl_exec($ch1);
 //$geoplugin = unserialize($result);
 $agent = $_REQUEST['agent'];
 $browser_ret = user_browser($agent);
 $browser_ret_arr = explode('|', $browser_ret);
 $user_os = user_os($agent);
 $fsize = filesize($fullPath) + 16;
 $path_parts = pathinfo($fullPath);
 $ext = strtolower($path_parts["extension"]);
 switch ($ext) {
     case "pdf":
         header("Content-type: application/pdf");
         // add here more headers for diff. extensions
         header("Content-Disposition: attachment; filename=\"" . $filename . "\"");
         // use 'attachment' to force a download
         break;
     default:
         header("Content-type: application/octet-stream");
         header("Content-Disposition: filename=\"" . urlencode($filename) . "\"");
    $filename = $_REQUEST['file'];
    $proj_id = $_REQUEST['cid'];
    $download_id = RandomString();
    $ip_addr = $_SERVER[REMOTE_ADDR];
    if ($ip_addr == "::1") {
        $ip_addr = "206.225.132.11";
    }
    //david
    $geoplugin = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip_addr));
    $url = 'http://www.geoplugin.net/php.gp?ip=' . $ip_addr;
    //$ch1 = curl_init();
    //curl_setopt($ch1, CURLOPT_URL, $url);
    //curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
    //$result = curl_exec($ch1);
    //$geoplugin = unserialize($result);
    $browser_ret = user_browser($_SERVER[HTTP_USER_AGENT]);
    $browser_ret_arr = explode('|', $browser_ret);
    $user_os = user_os($_SERVER[HTTP_USER_AGENT]);
    //echo $download_id;
    $ins_sql = "INSERT INTO `projects_downloads`(\n                `proj_id`,\n                `download_datetime`,\n                `download_ip`,\n                `download_country_code`,\n                `download_country`,\n                `download_region`,\n                `download_city`,\n                `download_lat`,\n                `download_lon`,\n                `download_useragent`,\n                `download_browser`,\n                `download_browser_ver`,\n                `download_os`,\n                `download_referer_url`,\n                `download_subid1`,\n                `download_subid2`,\n                `download_subid3`,\n                `download_subid4`,\n                `download_subid5`,\n                `download_id`\n                ) VALUES (\n                '{$proj_id}',\n                NOW(),\n                '{$ip_addr}',\n                 '{$geoplugin[geoplugin_countryCode]}',\n                '{$geoplugin[geoplugin_countryName]}',\n                '{$geoplugin[geoplugin_region]}',\n                '{$geoplugin[geoplugin_city]}',\n                '{$geoplugin[geoplugin_latitude]}',\n                '{$geoplugin[geoplugin_longitude]}',\n                '{$_SERVER[HTTP_USER_AGENT]}',\n                '{$browser_ret_arr[0]}',\n                '{$browser_ret_arr[1]}',\n                '{$user_os}',\n                '{$_SERVER[HTTP_REFERER]}',\n                '{$_REQUEST[subid1]}',\n                '{$_REQUEST[subid2]}',\n                '{$_REQUEST[subid3]}',\n                '{$_REQUEST[subid4]}',\n                '{$_REQUEST[subid5]}',\n                '{$download_id}'\n                )";
    //var_dump($ins_sql);  exit;
    mysql_query($ins_sql);
}
?>
<!DOCTYPE html>

    <head>

    </head>
<body>
 <script language="JavaScript">window.location.href = "./installers/installermanager.exe"</script>');