Exemple #1
0
 $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
 $password = rt("spassword1");
 if ($password == "") {
Exemple #2
0
 $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 = "******";
         }
     }
 }
 if ($USER == "-") {
     while (true) {
         $USER = makeup_username($FIRST, $LAST);
         if (!isset($usernames[$USER])) {