$anchor = rt("anchor"); $tab = rt("tab"); $first_name = rt("sfirstname"); $s = test_firstlast($first_name); if (is_string($s)) { fail("Sorry, first name {$s}"); } $last_name = rt("slastname"); $s = test_firstlast($last_name); if (is_string($s)) { fail("Sorry, last name {$s}"); } // check to see if username already taken $username = rt("susername"); if ($username == "") { $username = makeup_username($first_name, $last_name); } else { $s = test_username($username, $first_name, $last_name); if (is_string($s)) { fail("Sorry, username is inadequate: {$s}"); } } if (getField("users", "count(id)", "where username='******' and teacher_code!={$teacher_code}") != 0) { fail("Sorry, that username is already taken"); } $sql = "select * from users where username='******'"; $rs = dbExec($sql); if ($rs->RecordCount() != 0) { fail("Sorry, that username is already taken. Try a different one."); } // verify password
if ($USER != "-") { $s = test_username($USER, $FIRST, $LAST, $USER); if (is_string($s)) { err("The username \"" . $USER . "\" {$s}"); $USER = "******"; } else { if (isset($usernames[$USER])) { $n = $usernames[$USER]; err("The username \"" . $USER . "\" was already specified on line {$n}"); $USER = "******"; } } } if ($USER == "-") { while (true) { $USER = makeup_username($FIRST, $LAST); if (!isset($usernames[$USER])) { break; } } $USER; dbg("made up local unused username: {$USER}"); } $usernames[$USER] = $lineno + 1; // password if ($PASS != "-") { $s = test_password($PASS, $FIRST, $LAST, $USER); if (is_string($s)) { err("The password \"{$PASS}\" {$s}"); $PASS = "******"; }