/* ***** VERIFY SESSION ***** */ include "check_session.php"; if ( $username == "" ) header( "location:index.php" ); include "misc.php"; include "pgnlist.php"; function getQuoteContents( $line ) { $line = strchr( $line, '"' ); $line2 = substr( $line, 1, strrpos($line,'"')-1 ); return $line2; } ?>
|
/* BUILD GAME LIST FOR PGN ARCHIVE */
if ( isset($_GET) && isset($_GET["pgnfile"]) )
{
$pgnfile = $_GET["pgnfile"];
$hfile = fopen( "$res_pgns/$pgnfile", "r" );
$games = array(); $offsets = array(); $i = 0;
if ( $hfile )
{
$line = "";
while( !feof( $hfile ) )
{
while ( $line[0] != '[' && !feof($hfile) )
$line = fgets( $hfile, 80 );
$white = "???"; $black = "???"; $moves = 0;
$date = "???"; $result = "???";
while ( $line[0] != '1.' && !feof($hfile) )
{
if ( strncmp($line,"[White ",7)==0 )
$white = getQuoteContents($line);
if ( strncmp($line,"[Black ",6)==0 )
$black = getQuoteContents($line);
if ( strncmp($line,"[Date ",6)==0 )
$date = getQuoteContents($line);
if ( strncmp($line,"[Result ",6)==0 )
$result = getQuoteContents($line);
$line = fgets( $hfile, 80 );
}
$games[$i] = array( $white, $black, $date, $result,
ftell($hfile) - strlen($line) );
$i++;
while ( $line[0] != '[' && !feof($hfile) )
$line = fgets( $hfile, 100 );
}
fclose($hfile);
}
$pgn_selected = 1;
$title = "Select Game From Archive '$pgnfile'";
}
else
{
$pgn_selected = 0;
$title = "Select PGN Archive";
}
?>
=$title?>
|