dbg("updated user rec, changed to -deleted id={$student_id}"); logit("student record deleted by teacher {$teacher_code}"); } dbg("done"); anchorRedirect($anchor, $tab); } else { if ($action == "addstudent") { $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");
$l[3] = trim($l[3]); $full = $l[0] . ' ' . $l[1]; dbg("----- line {$lineno}: {$full}"); $FIRST =& $l[0]; $LAST =& $l[1]; $TEAM =& $l[2]; $ROLE =& $l[3]; $USER =& $l[4]; $PASS =& $l[5]; // first and last names $s = test_firstlast($FIRST); if (is_string($s)) { err("The first name \"" . $FIRST . "\" {$s}"); $FIRST = fix_firstlast($FIRST); } $s = test_firstlast($LAST); if (is_string($s)) { err("The last name \"" . $LAST . "\" {$s}"); $LAST = fix_firstlast($LAST); } // username 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 = "******";