<?php
// $Id: openpgn.php,v 1.2 2004/11/07 20:01:56 dadij Exp $
session_start();
/* load settings */
if (!isset($_CONFIG))
require 'config.php';
/* define constants */
require 'chessconstants.php';
/* include outside functions */
# if (!isset($_CHESSUTILS))
require 'chessutils.php';
require 'gui.php';
require 'chessdb.php';
/* allow WebChess to be run on PHP systems < 4.1.0, using old http vars */
# fixOldPHPVersions();
/* check session status */
// require 'sessioncheck.php';
/* debug flag */
define ("DEBUG", 0);
/* connect to database */
require 'connectdb.php';
/* load game */
$output_file = 'game'.$_SESSION['gameID'].'.pgn';
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP 1.1
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP 1.1
header('Pragma: no-cache'); // HTTP 1.0
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . 'GMT');
header('Content-Transfer-Encoding: none');
header('Content-Type: application/x-chess-pgn; name="'. $output_file . '"');
header('Content-Disposition: attachment; filename="' .$output_file . '"');
// header("Content-length: $content_len");
loadHistory();
ReturnGameInfo($_SESSION['gameID']);
writePGN();
mysql_close();
?>