"></a>
         <?php 
    echo "<b>";
    if ($act == $z['timeOfMove']) {
        echo "<font color='#FF0000'>";
        if ($newline) {
            echo $j . ".&nbsp;";
        }
        writeHistoryPGN("plain", 'single');
        echo "</b>";
        echo "</font>";
    } else {
        if ($newline) {
            echo $j . ".";
        }
        writeHistoryPGN("plain", true);
        echo "</b>";
    }
    ?>
         </a>

         <?php 
    $g2 = mysql_query("SELECT * FROM comments WHERE gameID = '{$gameID}'\n               \t\t  AND timeOfMove = '" . $z['timeOfMove'] . "' AND text <> ''");
    $count = mysql_num_rows($g2);
    if (($act == $z['timeOfMove'] || $showall == true) && $count > 0) {
        // get quick comment
        $q2 = mysql_query("SELECT * FROM comments WHERE gameID = '{$gameID}' AND timeOfMove = '" . $z['timeOfMove'] . "'\n               \t\t   AND quick = '1'\n                            GROUP BY text\n                            ORDER BY time ASC");
        while ($q = mysql_fetch_array($q2)) {
            //writeHistoryPGN("plain", 'single');
            $file = dirname(__FILE__) . "/images/analyze/comments/" . $q['text'];
            if (file_exists($file)) {
    function writeHistory()
    {
                 global $MSG_LANG,$db,$db_prefix;



        /* based on player's preferences, display the history */
        switch($_SESSION['pref_history'])
        {
            case 'verbose':
                writeVerbousHistory();
                break;

            case 'pgn':
                writeHistoryPGN();
                break;
            case 'graphic':

                echo ("<table border='0' width=300  bgcolor=black cellspacing=1 cellpading=1>\n");
                echo ("<tr><th bgcolor='beige'>".strtoupper($MSG_LANG["history"])."</th></tr>\n");
                echo ("<tr><td bgcolor=white>");
                writeHistoryPGN("plain", 'chess');
                echo ("</td></tr></table>");
            break;
        }
    }
Exemple #3
0
function writeHistory()
{
    global $numMoves;
    /* old PHP versions don't have _POST, _GET and _SESSION as auto_globals */
    if (!minimum_version("4.1.0")) {
        global $_POST, $_GET, $_SESSION;
    }
    /* based on player's preferences, display the history */
    $moves = array();
    // Make sure that $moves is defined
    switch ($_SESSION['pref_history']) {
        case 'verbous':
            $moves = writeVerbousHistory();
            break;
        case 'pgn':
            $moves = writeHistoryPGN();
            break;
    }
    $comma = '';
    echo "var moves = [";
    for ($i = 0; $i < count($moves); $i++) {
        echo $comma;
        if ($i % 4 == 0) {
            // Four moves on each line
            echo "\n";
        }
        echo "['" . $moves[$i][0] . "', '" . $moves[$i][1] . "']";
        $comma = ', ';
    }
    echo "];\n";
}
            $result = "1-0";
        } else {
            if ($row['gameMessage'] == "checkMate" && $row['messageFrom'] == "white") {
                $result = "1-0";
            } else {
                if ($row['gameMessage'] == "checkMate" && $row['messageFrom'] == "black") {
                    $result = "0-1";
                } else {
                    if ($row['gameMessage'] == "draw") {
                        $result = "1/2-1/2";
                    } else {
                        $result = "*";
                    }
                }
            }
        }
    }
    //In progress
}
$date = date("Y.m.d");
echo "[Site \"http://www.Webmaster play free chess\"]\n";
echo "[Event gameID " . $_SESSION[gameID] . "]\n";
//echo "[Event gameID \'$gameID'\]\n";
//echo "[Site \"http://www.Webmaster play free chess"\"]\n";
echo "[Date \"{$date}\"]\n";
echo "[Round \"-\"]\n";
echo "[White \"" . $row1['player1_name'] . " {$row1['r1']}\"]\n";
echo "[Black \"" . $row1['player2_name'] . " {$row1['r2']}\"]\n";
echo "[Result \"{$result}\"]\n";
writeHistoryPGN("plain");
echo $result;