示例#1
0
     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 == "") {
     $password = makeup_password($first_name, $last_name);
 } else {
     $s = test_password($password, $first_name, $last_name, $username);
     if (is_string($s)) {
         fail("Sorry, password is inadequate: {$s}");
     }
 }
 if ($teacher_code == "") {
     fail("No teacher code provided.");
 }
 $sql = "select * from users where active=1 and user_type='t' and teacher_code={$teacher_code}";
 dbg("sql={$sql}");
 $rs = dbExec($sql);
 if ($rs->RecordCount() != 1) {
     fail("The teacher-code provided is invalid. Please re-enter.");
 }
示例#2
0
         }
     }
     $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 = "******";
     }
 }
 if ($PASS == "-") {
     $PASS = makeup_password(6);
     dbg("made up password: {$PASS}");
 }
 // roles
 if ($ROLE != "-") {
     // look for role entered in $roledata
     $c = count($roledata);
     for ($i = 1; $i < $c; $i += 3) {
         if (lwr($ROLE) == lwr($roledata[$i])) {
             dbg("found valid role string {$ROLE}");
             // use properly cased $roledata version
             $ROLE = $roledata[$i];
             break;
         }
     }
     if ($i > $c) {