exit(doReadFile($subject, $path)); case 'rename': nonce_check(); exit(doRename($subject, $path)); case 'delete': nonce_check(); exit(doDelete($subject, $path)); case 'saveEdit': nonce_check(); exit(doSaveEdit($subject, $path)); case 'copy': nonce_check(); exit(doCopy($subject, $path)); case 'move': nonce_check(); exit(doMove($subject, $path)); case 'moveList': exit(moveList($subject, $path)); case 'installCodeMirror': exit(installCodeMirror()); case 'fileExists': exit(file_exists($path . '/' . $subject)); case 'getfs': exit(getFs($path . '/' . $subject)); case 'remoteCopy': nonce_check(); exit(doRemoteCopy($path)); } } /** * no action; list current directory
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> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
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) $inicio = mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y"));
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!"); */ } } }