function getTeamInfo() { global $contest; global $team; global $type; global $teamid; global $avail; $teamid = $_GET['id']; if (!checkTeam($teamid)) { error("You can't edit this team"); } if ($avail["teamen"]) { assertPost("teamen"); } if ($avail["teamcn"]) { assertPost("teamcn"); } $_SESSION["teamen"] = $_POST["teamen"]; $team["enname"] = $_POST["teamen"]; $_SESSION["teamcn"] = $_POST["teamcn"]; $team["cnname"] = $_POST["teamcn"]; // $team["date"] = "NOW()"; $type["date"] = 1; $team["cid"] = $contest["cid"]; return true; }
function getTeamInfo() { global $contest; global $team; global $type; global $avail; if ($avail["teamen"]) { assertPost("teamen"); } if ($avail["teamcn"]) { assertPost("teamcn"); } $_SESSION["teamen"] = $_POST["teamen"]; $team["enname"] = $_POST["teamen"]; $_SESSION["teamcn"] = $_POST["teamcn"]; $team["cnname"] = $_POST["teamcn"]; $team["date"] = "NOW()"; $type["date"] = 1; $team["cid"] = $contest["cid"]; return true; }
// print "$val=".$_POST[; if (!isset($_POST[$val]) || empty($_POST[$val])) { error("Fields must not be empty!"); } } function checkUsername($username) { $len = strlen($username); for ($i = 0; $i < $len; $i++) { if ($username[$i] < 'a' || $username[$i] > 'z') { error("Only english letters allowed"); } } } assertPost("tid"); assertPost("password"); $id = strtolower($_POST["tid"]); checkUsername($id); $password = $_POST["password"]; $cid = $contest["cid"]; $sql = "SELECT * FROM team WHERE cid='{$cid}' AND id='{$id}'"; $result = mysql_query($sql); if (mysql_num_rows($result) > 0) { error("User name already exists"); } $sql = "INSERT team (id, password, cid, date) VALUES ('{$id}', '{$password}', '{$cid}', Now())"; $result = mysql_query($sql); $tid = mysql_insert_id(); $_SESSION["tid"] = $tid; print "team id is {$tid} <br />"; $sql = "INSERT contestant (tid) VALUES ('{$tid}')";