$fnames_d = array (
"files/libgoboard.v0.91.tgz",
"files/libgoboard.v0.92.tgz",
"files/libgoboard.v0.92.1.tgz",
"files/libgoboard.v0.93.1.tgz",
"files/libgoboard.v0.94.tgz",
"files/libgoboard.v0.95.tgz",
"files/epsilon_trick.pdf",
"files/libgoboard.v0.96.tgz",
"files/libgoboard.v0.97.tgz",
"files/libgoboard.v0.98.tgz",
"files/libgoboard.v0.99.tgz",
"files/libgoboard.v0.100.tgz",
"files/libgoboard.v0.101.tgz",
"files/libego.v0.104.tgz",
"files/libego.v0.106.tgz",
"files/libego.v0.107.tgz",
"files/libego.v0.108.tgz",
"files/libego.v0.109.tgz",
"files/libego.v0.110.tgz",
);
$file_no = $_GET["file_no"];
$fname_d = $fnames_d[(int)$file_no];
$fname_c = $fname_d . ".cnt";
$fname_l = $fname_d . ".log";
clearstatcache();
ignore_user_abort(true);
$ff_d = fopen($fname_c ,"r+b");
if (flock($ff_d, LOCK_EX)) {
$currentcount = chop(fread($ff_d, 100));
rewind($ff_d);
$newcount = $currentcount;
++$newcount;
fwrite($ff_d, $newcount);
fflush($ff_d);
ftruncate($ff_d, ftell($ff_d));
flock($ff_d, LOCK_UN);
} else {
echo "(Couldn't lock file!)";
}
fclose ($ff_d);
$ff_l = fopen($fname_l ,"a");
if (flock($ff_l, LOCK_EX)) {
fwrite($ff_l, $_SERVER['REMOTE_ADDR']);
fwrite($ff_l, " - ");
fwrite($ff_l, gethostbyaddr ( $_SERVER['REMOTE_ADDR']) );
fwrite($ff_l, " - ");
fwrite($ff_l, $_SERVER['REQUEST_URI']);
fwrite($ff_l, " - ");
fwrite($ff_l, date("Y-m-d H:i:s"));
fwrite($ff_l, " - ");
fwrite($ff_l, $_SERVER['HTTP_REFERER']);
fwrite($ff_l, " - \"");
fwrite($ff_l, $_SERVER['HTTP_USER_AGENT']);
fwrite($ff_l, "\"\n");
flock($ff_l, LOCK_UN);
}
fclose ($ff_l);
ignore_user_abort(false);
$loc = sprintf ("Location: %s", $fname_d);
/*
echo "
";
print ((int) $file_no + 1);
echo "
" . $fname_d;
echo "
" . $fname_c;
echo "
" . $fname_l;
*/
header($loc);
?>