} } } } } else { // So now we sort each team into order sortrank($hplayer, $pars->Rankfuzz); sortrank($aplayer, $pars->Rankfuzz); // Now assign colours either WBW or BWB $cols[0] = rand(1, 2); $cols[1] = 3 - $cols[0]; $cols[2] = $cols[0]; } // If matchdate has changed, fix it $newdate = new Matchdate(); $newdate->frompost(); $newslack = $_POST["slackd"]; // Fix changed date if ($newdate->unequal($mtch->Date) || $newslack != $mtch->Slackdays) { $mtch->Date = $newdate; $mtch->Slackdays = $newslack; $mtch->dateupdate(); } // Set up game details according to who is white/black // col=1 means "home" player is white otherwise black function setgteams($g, $col, $hteam, $ateam, $hplay, $aplay) { global $hcapable, $hred; // Force colour to white for stronger player if handicaps apply and rank // difference is greater than handicap reduction if ($hcapable) {
include 'php/game.php'; $div = $_POST['div']; if (strlen($div) == 0) { $mess = "No division?"; include 'php/wrongentry.php'; exit(0); } $hteam = $_POST['hteam']; $ateam = $_POST['ateam']; $slack = $_POST['slackd']; if (strlen($hteam) == 0 || strlen($ateam) == 0) { $mess = "Missing teams?"; include 'php/wrongentry.php'; } $dat = new Matchdate(); $dat->frompost(); $mtch = new Match(0, $div); $mtch->set_hometeam($hteam); $mtch->set_awayteam($ateam); $mtch->Date = $dat; $mtch->Slackdays = $slack; try { // Fetch the team details not because we need them, but // so as to check for garbled team names. $mtch->fetchteams(); $mtch->create(); // That sets the match ind in $mtch which the updmatch call uses later. } catch (MatchException $e) { $mess = $e->getMessage(); include 'php/dataerror.php'; exit(0);
include 'php/teammemb.php'; include 'php/match.php'; include 'php/matchdate.php'; include 'php/game.php'; include 'php/news.php'; $g = new Game(); try { $g->frompost(); $g->fetchdets(); } catch (GameException $e) { $mess = $e->getMessage(); include 'php/wrongentry.php'; exit(0); } $date_played = new Matchdate(); $date_played->frompost(); $sgfdata = ""; $fn = $_FILES["sgffile"]; if ($fn['error'] == UPLOAD_ERR_OK && preg_match('/.*\\.sgf$/i', $fn['name']) && $fn['size'] > 0) { $sgfdata = file_get_contents($fn['tmp_name']); } if ($date_played->unequal($g->Date)) { $g->reset_date($date_played); } $mtch = $g->set_result($_POST["result"], $_POST["resulttype"]); if (strlen($sgfdata) != 0) { $g->set_sgf($sgfdata); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html>