function game_sudoku_continue($id, $game, $attempt, $sudoku, $endofgame, $context) { global $CFG, $DB, $USER; if ($endofgame) { game_updateattempts($game, $attempt, -1, true); $endofgame = false; } if ($attempt != false and $sudoku != false) { return game_sudoku_play($id, $game, $attempt, $sudoku, false, false, $context); } if ($attempt == false) { $attempt = game_addattempt($game); } //new game srand((double) microtime() * 1000000); $recsudoku = getrandomsudoku(); if ($recsudoku == false) { print_error('Empty sudoku database'); } $newrec = new stdClass(); $newrec->id = $attempt->id; $newrec->guess = ''; $newrec->data = $recsudoku->data; $newrec->opened = $recsudoku->opened; $need = 81 - $recsudoku->opened; $closed = game_sudoku_getclosed($newrec->data); $n = min(count($closed), $need); //if the teacher set the maximum number of questions if ($game->param2 > 0) { if ($game->param2 < $n) { $n = $game->param2; } } $recs = game_questions_selectrandom($game, CONST_GAME_TRIES_REPETITION * $n); if ($recs === false) { mysql_execute("DELETE FROM {game_sudoku} WHERE id={$game->id}"); print_error(get_string('no_questions', 'game')); } $closed = array_rand($closed, $n); $selected_recs = game_select_from_repetitions($game, $recs, $n); if (!game_insert_record('game_sudoku', $newrec)) { print_error('error inserting in game_sudoku'); } $i = 0; $field = $game->sourcemodule == 'glossary' ? 'glossaryentryid' : 'questionid'; foreach ($recs as $rec) { if ($game->sourcemodule == 'glossary') { $key = $rec->glossaryentryid; } else { $key = $rec->questionid; } if (!array_key_exists($key, $selected_recs)) { continue; } $query = new stdClass(); $query->attemptid = $newrec->id; $query->gamekind = $game->gamekind; $query->gameid = $game->id; $query->userid = $USER->id; $query->col = $closed[$i++]; $query->sourcemodule = $game->sourcemodule; $query->questionid = $rec->questionid; $query->glossaryentryid = $rec->glossaryentryid; $query->score = 0; if (($query->id = $DB->insert_record('game_queries', $query)) == 0) { print_error('error inserting in game_queries'); } game_update_repetitions($game->id, $USER->id, $query->questionid, $query->glossaryentryid); } game_updateattempts($game, $attempt, 0, 0); game_sudoku_play($id, $game, $attempt, $newrec, false, false, $context); }
} if ($_POST['male']) { $radio = 'male'; } else { if ($_POST['female']) { $radio = 'female'; } } if ($_POST['maths']) { $check2 = 'maths'; } else { if ($_POST['science']) { $check2 = 'science'; } else { if ($_POST['computers']) { $check2 = 'computers'; } else { if ($_POST['mechanics']) { $check2 = 'mechanics'; } else { if ($_POST['per_dev']) { $check2 = 'personality development'; } } } } } $s = mysql_query("insert into mentee values('{$name}','{$radio}',{$phone},'{$check2}','{$check}','pending')"); mysql_execute($s); echo 'Successfully sent message. DSF will contact you shortly'; mysql_close($con);