Example #1
0
            } else {
                if (strpos($s, "INPUT") === 0) {
                    while ($s !== false && $s != "END_OF_INPUT\n") {
                        $s = next($file);
                    }
                }
            }
        }
        $s = next($file);
    }
    $link = getDBConnection();
    if (mysqli_select_db($link, getDBName())) {
        $res = mysqli_query($link, "SELECT strategy1, strategy2, duels.status FROM duels WHERE duels.id={$duel}");
        $game = getGameName($gameId);
        $user1 = getNicknameByStrategy(mysqli_result($res, 0, 0));
        $user2 = getNicknameByStrategy(mysqli_result($res, 0, 1));
        $status = mysqli_result($res, 0, 2);
    }
    ?>

            <h2>Партия по игре <?php 
    echo $game;
    ?>
 между <?php 
    echo $user1;
    ?>
 и <?php 
    echo $user2;
    ?>
<div id = "hiddenScore"><?php 
    echo $status;
Example #2
0
                            if ($curStat == "WIN") {
                                if ($playerId == 1) {
                                    $strategy = $row['strategy1'];
                                } else {
                                    $strategy = $row['strategy2'];
                                }
                            } else {
                                if ($playerId == 1) {
                                    $strategy = $row['strategy2'];
                                } else {
                                    $strategy = $row['strategy1'];
                                }
                            }
                            setPlayerScore($row['round'], $strategy, 2);
                        }
                    }
                }
                $log = fopen("./logs/" . $row['id'] . ".txt", "w");
                fwrite($log, "PLAYERS\n" . getNicknameByStrategy($row['strategy1']) . "\n" . getNicknameByStrategy($row['strategy2']) . "\n");
                foreach ($output as $line) {
                    fwrite($log, $line . "\n");
                }
                fclose($log);
                mysqli_query($link, "UPDATE duels SET status = '" . $testerStat . "' WHERE id = " . $row['id']);
                $cont = true;
            }
        } while ($cont);
    }
    flock($fp, LOCK_UN);
}
fclose($fp);