Example #1
0
     }
     dbg("numprovided={$numprovided}");
     dbg("n={$n}");
     // Add students to the group
     $added = 0;
     foreach ($students as $s) {
         $sql = "update users set group_id={$gid} where active=1 and id={$s} and teacher_code={$teacher_code} and group_id=0";
         $rs = dbExec($sql);
         logit("student {$id} added to group {$gid} by teacher {$teacher_code}");
         $added++;
         $n--;
         if ($n == 0) {
             break;
         }
     }
     msgRedirect("{$added} Students added to group successfully.", $anchor);
 } else {
     if ($action == "up") {
         $anchor = rt("anchor");
         $sid = rt("s");
         $tab = rt("tab");
         bumpStudentClass($sid, -1);
         anchorRedirect($anchor, $tab);
     } else {
         if ($action == "dn") {
             $anchor = rt("anchor");
             $sid = rt("s");
             $tab = rt("tab");
             bumpStudentClass($sid, 1);
             anchorRedirect($anchor, $tab);
         } else {
Example #2
0
        $password = $username;
        $school_code = school_code_given_teacher_code($teacher_code);
        $first_name = $username;
        $last_name = $username;
        $email = $username . "@" . $username . ".com";
        $econf = "machine-generated-user";
        $user_type = "s";
        $sql = "insert into users (active,econf,username,password,email,user_type,first_name,last_name,teacher_code,school_code) values (1,'{$econf}','{$username}','{$password}','{$email}','{$user_type}','{$first_name}','{$last_name}',{$teacher_code},{$school_code})";
        $rs = dbExec($sql);
        $insid = $db->Insert_ID();
        $sql = "insert into tracking (user_id) values ({$insid})";
        $rs = dbExec($sql);
        $sql = "insert into progress (user_id) values ({$insid})";
        $rs = dbExec($sql);
        logit("user {$username} created by DEV for teacher {$teacher_code}");
        msgRedirect("User added OK: username={$username} password={$password} school_code={$school_code} teacher_code={$teacher_code} group_id={$group_id}");
        exit;
    }
}
?>



<center>

<h2>Quickly Add Fake Users</h2>

Don't use this form when there is real user data in the

database as it creates user records semi-randomly.
Example #3
0
            $sql .= "{$v},";
        }
        $sql .= "code) values (";
        foreach ($a as $v) {
            $vv = $_REQUEST[$v];
            $sql .= "'{$vv}',";
        }
        $sql .= "{$school_code})";
        // echo "sql=$sql";
        $rs = $db->Execute($sql);
        if (!$rs) {
            p_sqlfail($db, $sql);
        }
        $lastid = $db->Insert_ID();
        logit("school record {$lastid} added by {$uid}");
        msgRedirect("School successfully added.");
        exit;
    }
}
?>



<center>

<h2>Add a school</h2>



<?php 
if (false) {
Example #4
0
function msgRedirectRed($msg, $a)
{
    msgRedirect("<font color=red>{$msg}</font>");
}