GetLeaderboard();
}
if (isset($_POST['get_games'])) {
    GetGames();
}
if (isset($_POST['send_message'])) {
    $Message = $_POST["message"];
    SendMessage($Message);
}
if (isset($_POST['update_game'])) {
    UpdateBoard();
}
if (isset($_POST['create_game'])) {
    $GameName = $_POST["game_name"];
    $Username = $_SESSION["Username"];
    $output = CreateGame($GameName, $Username);
    UpdateBoard();
}
if (isset($_POST['game_hit'])) {
    $Username = $_SESSION["Username"];
    $GameID = $_SESSION["GameID"];
    if (IsUserTurn($Username, $GameID)) {
        HitPlayer();
        UpdateBoard();
    }
}
if (isset($_POST['game_fold'])) {
    $Username = $_SESSION["Username"];
    $GameID = $_SESSION["GameID"];
    if (IsUserTurn($Username, $GameID)) {
        FoldPlayer();
Exemple #2
0
}
function encrypt($string = "")
{
    $key = base64_decode("wGNuqvkYNrRxKNfGN2cS50oVfTIW1FRAlW0otF3KLxo=");
    $iv = base64_decode("bT31M32Ik5TKkCS/dvasSTJHwcHdKyCZ1ix7LHwVWIA=");
    return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, addpadding($string), MCRYPT_MODE_CBC, $iv));
}
//PHP D2NG Server
switch ($msgs[0]) {
    case '1':
        //Login
        Login($msgs[1], $msgs[2], $msgs[3], $date, 0);
        break;
    case '2':
        //CreateGame
        CreateGame($msgs[1], $msgs[2], $msgs[3], $msgs[4], $msgs[5], $msgs[6], $msgs[7], $msgs[8], $date);
        break;
    case '3':
        // Request to remove
        RequestToRemove($msgs[1], $date);
        break;
    case '4':
        //Request GameList and data
        requstGameList($msgs[1], $date, $msgs[2], $msgs[3]);
        break;
    case '5':
        //JoinGame
        JoinGame($msgs[1], $msgs[2], $msgs[3], $date);
        break;
    case '6':
        //ping!