コード例 #1
0
                {

                    if ($newBoard[$i][$j] != 0)
                    {
                        if ($newBoard[$i][$j] & BLACK)
                            $tmpColor = "black";
                        else
                            $tmpColor = "white";
                        $tmpPiece = getPieceName($newBoard[$i][$j]);
                        mysql_query("INSERT INTO pieces (gameID, color, piece, row, col) VALUES ($gameID, '$tmpColor', '$tmpPiece', $i, $j)");
				    }
                }
            }
            /*  Flag the game 1*/
            // mysql_query("UPDATE games set gameok='1' WHERE gameID = ".$gameID);
            saveHistory($POST);
            doMove($POST);
            mysql_query("UPDATE games SET lastMove = NOW() WHERE gameID = '$gameID'");

            // Update players time
	        $ptime = mysql_query("SELECT * from history where curColor<>'$playersColor' AND gameID=".$_SESSION['gameID']." ORDER BY timeOfMove DESC limit 1");
            $rowtime = mysql_fetch_array($ptime);
            $cor = $rowtime['curColor'];
            $lastmove = $rowtime['timeOfMove'];

			// Length:
            $v = explode(" ",$lastmove);
            $hora = explode(":",$v[1]);
            $data = explode("-",$v[0]);

            if ($lastmove == 0)
コード例 #2
0
    $tmpIsValid = true;
    if ($numMoves == -1 || $numMoves % 2 == 1) {
        /* White's move... ensure that piece being moved is white */
        if (($board[$_POST['fromRow']][$_POST['fromCol']] & BLACK) != 0 || $board[$_POST['fromRow']][$_POST['fromCol']] == 0) {
            /* invalid move */
            $tmpIsValid = false;
        }
    } else {
        /* Black's move... ensure that piece being moved is black */
        if (($board[$_POST['fromRow']][$_POST['fromCol']] & BLACK) != BLACK || $board[$_POST['fromRow']][$_POST['fromCol']] == 0) {
            /* invalid move */
            $tmpIsValid = false;
        }
    }
    if ($tmpIsValid) {
        saveHistory();
        doMove();
        saveGame();
    }
} elseif ($history[$numMoves]['curPiece'] == 'pawn' && $history[$numMoves]['promotedTo'] == null) {
    // Incomplete promotion?
    if ($history[$numMoves]['toRow'] == 7 || $history[$numMoves]['toRow'] == 0) {
        $isPromoting = true;
    }
}
mysql_close();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
コード例 #3
0
/**
 * Process feeds
 *
 * @param array $feeds List of feeds to process
 * @param array $config Configuration array
 * @return array Processing stats
 */
function processFeeds($feeds, $config)
{
    $result = array();
    $shows = getShows($config);
    $excludes = getExcludes($config);
    foreach ($feeds as $feed) {
        $feedItems = getFeedItems($feed);
        $cleanItems = cleanFeedItems($feedItems, $shows, $excludes);
        $history = getHistory($config);
        foreach ($cleanItems as $d) {
            $entry = $d['show'] . " " . $d['episode'];
            if (!in_array($entry, $history)) {
                downloadTorrent($d['url'], $config);
                $history[] = $entry;
                $result[$feed][] = $entry;
            }
        }
        saveHistory($history, $config);
    }
    return $result;
}
コード例 #4
0
ファイル: main.php プロジェクト: superchangme/jsplugin
function saveLotteryInfo()
{
    //add robot ctrl
    $form = array();
    $form["name"] = $_POST['name'];
    //$_POST['name'];
    $form['phone'] = $_POST['phone'];
    //$_POST['phone'];
    $form['address'] = $_POST['address'];
    //$_POST['address'];
    $form["daily_limit"] = $_SESSION['prize']['daily_limit'];
    $form['describe'] = $_SESSION['prize']['describe'];
    $form['pid'] = $_SESSION['prize']['pid'];
    $form['total'] = $_SESSION['prize']['total'];
    $code = saveHistory($form);
    return $code;
}
コード例 #5
0
         // White's move... ensure that piece being moved is white
         if (($board[$_POST['from_row']][$_POST['from_col']] & BLACK) != 0 || $board[$_POST['from_row']][$_POST['from_col']] == 0) {
             // invalid move would be 0,0
             $tmpIsValid = false;
         }
         //$validshit = "was whites move"; //debug string
     } else {
         // Black's move... ensure that piece being moved is black
         if (($board[$_POST['from_row']][$_POST['from_col']] & BLACK) != BLACK || $board[$_POST['from_row']][$_POST['from_col']] == 0) {
             // invalid move
             $tmpIsValid = false;
         }
         //$validshit = "was blacks move"; //debug string
     }
     if ($tmpIsValid) {
         $save_game_result = saveHistory();
         $move_done_result = doMove();
         $game_saved_true = saveGame();
         //note- these should be done together and fail safed- ability to roll back if any one part breaks
     } else {
         /*echo "<PRE>";
           var_dump($validshit);
           var_dump($board[$_POST['from_row']][$_POST['from_col']]);    //int(0)
           $whatres = ($board[$_POST['from_row']][$_POST['from_col']] & BLACK); //int(0)
           var_dump($whatres);
           var_dump($board);
           var_dump(BLACK);
           var_dump($_POST);
           die("You Goofed Up, Brian HAHAHA! ".var_dump($tmpIsValid)."  Aint valid - you need a JS Guru!"); */
     }
 }