// Note that the "updatename" function does any consequent // updates like changing team captain name if the player is a // team captain. $chname = false; $newplayer = new Player($playname); if (!$origplayer->is_same($newplayer)) { checkname($newplayer); $origplayer->updatename($newplayer); $chname = true; } if ($origplayer->KGS != $kgs) { checkclash("kgs", $kgs); $origplayer->KGS = $kgs; } if ($origplayer->IGS != $igs) { checkclash("igs", $igs); $origplayer->IGS = $igs; } $origplayer->Rank = new Rank($rank); $origplayer->Club = new Club($club); $origplayer->Email = $email; $origplayer->OKemail = $okem; $origplayer->Trivia = $trivia; $origplayer->Phone = $phone; $origplayer->Notes = $notes; $origplayer->Latestcall = $latest == "None" ? "" : $latest; if ($origplayer->ILdiv == 0) { if (isset($_POST["join"])) { $origplayer->ILdiv = assign_ildiv($rank); } } else {
function checkclash($column, $value) { if (strlen($value) == 0) { return; } $qvalue = mysql_real_escape_string($value); $ret = mysql_query("select {$column} from player where {$column}='{$qvalue}'"); if ($ret && mysql_num_rows($ret) != 0) { include 'php/nameclash.php'; exit(0); } } // Check user name, KGS and IGS accounts (if any) don't clash checkclash('user', $userid); checkclash('kgs', $kgs); checkclash('igs', $igs); $player->Rank = new Rank($rank); $player->Club = new Club($club); $player->Email = $email; $player->OKemail = $okem; $player->Trivia = $trivia; $player->Phone = $phone; $player->KGS = $kgs; $player->IGS = $igs; $player->Userid = $userid; $player->Notes = $notes; $player->Latestcall = $latest == "None" ? "" : $latest; if ($joinil) { $player->ILdiv = assign_ildiv($rank); } $player->create();
$club->create(); $Title = "Club {$club->display_name()} created OK"; break; default: try { $club = new Club(); $club->frompost(); $club->fetchdets(); } catch (ClubException $e) { $mess = $e->getMessage(); include 'php/wrongentry.php'; exit(0); } // If name has changed, check it doesn't clash if ($newcode != $club->Code) { checkclash($newcode); $qcode = mysql_real_escape_string($newcode); mysql_query("update club set code='{$qcode}' where {$club->queryof()}"); $club->Code = $newcode; } $club->Name = $newname; $club->Contactfirst = $contfirst; $club->Contactlast = $contlast; $club->Contactemail = $contemail; $club->Contactphone = $contphone; $club->Website = $website; $club->Night = $night; $club->Schools = $sch; $club->update(); $Title = "Club {$club->display_name()} updated OK"; break;