Ignore:
Timestamp:
1/3/2009 12:42:49 AM (3 years ago)
Author:
lowjoel
Message:

-Implemented supersedance for updates
-Implemented the content-length header for browsers to know how much to download
-

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/website/download.php

    r660 r848  
    55 
    66//Get the download link associated with the download 
    7 $query = mysql_query(sprintf('SELECT Link FROM downloads WHERE DownloadID=%d', intval($_GET['id']))); 
     7$query = mysql_query(sprintf('SELECT Link FROM downloads WHERE DownloadID=%d AND Superseded=0', intval($_GET['id']))); 
    88if (!$query) 
    99    exit; 
     
    1919{ 
    2020    $fileName = substr($row['Link'], 1); 
    21     header("content-type: application/octet-stream"); 
     21    header("Content-Type: application/octet-stream"); 
     22    header('Content-Length: ' . filesize('./downloads/' . $fileName)); 
    2223    if (strpos($_SERVER['HTTP_USER_AGENT'], "MSIE") !== false) 
    2324    { 
    2425        //IE browser 
    25         header('Content-Disposition: inline; filename="'.$fileName.'"'); 
     26        header('Content-Disposition: inline; filename="' . $fileName . '"'); 
    2627        header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 
    2728        header('Pragma: public'); 
     
    2930    else 
    3031    { 
    31         header('Content-Disposition: attachment; filename="'.$fileName.'"'); 
     32        header('Content-Disposition: attachment; filename="' . $fileName . '"'); 
    3233        header('Pragma: no-cache'); 
    3334    } 
Note: See TracChangeset for help on using the changeset viewer.