function move_msg() { global $print, $x7s, $x7c, $db, $prefix; //You cannot do anything if you are not master if (!checkIfMaster()) { $body = "Non sei autorizzato a compiere questa operazione"; $print->board_window("Non autorizzato", $body, indice_board()); return; } //Do the move if (isset($_GET['dest'])) { $db->DoQuery("UPDATE {$prefix}boardmsg SET board='{$_GET['dest']}' WHERE id='{$_GET['move']}' OR father='{$_GET['move']}'"); show_board($_GET['dest']); return; } $query = $db->DoQuery("SELECT name, id FROM {$prefix}boards ORDER BY name"); //Move form $body = "<form action=\"./index.php\" method=\"get\">\n\n\t\t\t<input type=\"hidden\" name=\"act\" value=\"boards\">\n\t\t\t<input type=\"hidden\" name=\"move\" value=\"{$_GET['move']}\">\n\n Board di destinazione\n\n <select class=\"button\" name=\"dest\">"; while ($row = $db->Do_Fetch_Assoc($query)) { $body .= "<option value=\"{$row['id']}\">{$row['name']}</option>"; } $body .= "</select>\n <br><br><input type=\"submit\" value=\"Sposta\" class=\"button\">\n </form>"; $print->board_window("Sposta messaggio", $body, indice_board()); }
<?php $rows = $_POST["num_rows"]; $cols = $_POST["num_cols"]; $mines = $_POST["num_mines"]; $board = fill_board($rows, $cols, $mines); // Call to Function Fill_Board $board = check_fields($board); // Call to Function Check_fields show_board($board); // Call to Function Show_Board /** -- Function fill_board(param1,param2,param3) -- @param1 int $num_rows Number of Rows. @param2 int $num_cols Number of Columns. @param3 int $mines Number of mines. @return Array . **/ function fill_board($num_rows, $num_cols, $mines) { $board = array(array()); // Setup the board with a 2 dimensional array, X/Y axis. // Setup the Board with 0 values in all fields. for ($f = 0; $f < $num_rows; $f++) { for ($c = 0; $c < $num_cols; $c++) { $board[$f][$c] = "0"; } } // Place all the mines given by the $mines parameter randomly.