Skip to content

Instantly share code, notes, and snippets.

@justinkelly
Created July 23, 2013 02:18
Show Gist options
  • Save justinkelly/6059359 to your computer and use it in GitHub Desktop.
Save justinkelly/6059359 to your computer and use it in GitHub Desktop.
<?php
$user = $_SERVER['PHP_AUTH_USER'];
$date = date("Y-m-d H:i:s");
$myFile = "download_log.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = "Date , ". $date ." , User , ". $user ."\n";
fwrite($fh, $stringData);
fclose($fh);
if($_GET['format'] =='mac')
{
$File = 'endnote_x6_0_1_mac.zip';
}else {
$File = 'endnote_x6_0_1_win.zip';
}
header('Content-Type: application/zip');
header("Content-Transfer-Encoding: Binary");
header("Content-Length: " . filesize($File));
header("Content-disposition: attachment; filename=\"".$File."\"");
readfile($File);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment