Пример #1
0
/**
 * print a list of the user's classes
 *
 * parses the data from parse_class_list()
 */
function print_students_classes($id)
{
    $class_list = classes_by_semester($id, current_semester);
    $classes = explode(",", $class_list);
    // get rid of the empty part of the array
    $empty = count($classes) - 1;
    unset($classes[$empty]);
    print "<table>";
    foreach ($classes as $class) {
        // get the class's name
        $class_name = query("SELECT `name` FROM `classes` WHERE `ID`='{$class}' LIMIT 1");
        $result = result($class_name);
        $class_name = $result->name;
        print "<tr><td><a href=\"classes.php?class={$class}\" title=\"{$class_name}\">{$class_name}</a></td><td>" . class_average($id, $class, current_semester) . "</td></tr>";
    }
    print "</table>";
}
Пример #2
0
 if (is_numeric($_GET['u']) == FALSE) {
     die("Invalid user ID.");
 }
 $user = escape_string($_GET['u']);
 if (!isset($_GET['p']) or is_numeric($_GET['p']) == FALSE) {
     die("Invalid password.");
 }
 $actual_password = gen_rss_pass($user);
 if ($actual_password != escape_string($_GET['p'])) {
     die("Incorrect password.");
 }
 $number = 3;
 $lastbuild = time();
 rss_header("latest class news", "latest news for various classes", server_root . "news.php", $lastbuild);
 // get the classes the user is currently in
 $users_classes = classes_by_semester($user, current_semester);
 // get rid of the extra comma
 $users_classes = substr($users_classes, 0, strlen($users_classes) - 1);
 $classes = explode(",", $users_classes);
 foreach ($classes as $class) {
     // get the class's name
     $class_data = get_class_data($class);
     $class_data = explode("::", $class_data);
     $class_name = $class_data[0];
     $news = get_news($class, $number);
     if ($news != "No news.") {
         $news_post = explode("_____", $news);
         foreach ($news_post as $the_news) {
             if ($the_news != "") {
                 $the_news = explode("::::", $the_news);
                 $timestamp = $the_news[1];
Пример #3
0
 $student = $row->students;
 $student = explode(",", $student);
 $i = 0;
 foreach ($student as $the_student) {
     // get his or her name
     $student_name = @query("SELECT `firstname`, `surname` FROM `users` WHERE `ID`='{$the_student}' LIMIT 1") or die("Error checking the database.");
     while ($row2 = result($student_name)) {
         $students_name = stripslashes($row2->firstname) . " " . stripslashes($row2->surname);
     }
     print "<p class=\"title\">{$students_name}</p>";
     $requested_class = $_GET['class'];
     if (is_numeric($requested_class) != "true") {
         cust_die("Invalid class.");
     }
     // see if they're in the class
     $class_list = classes_by_semester($the_student, current_semester);
     $classes = explode(",", $class_list);
     // get rid of the empty part of the array
     $empty = count($classes) - 1;
     unset($classes[$empty]);
     foreach ($classes as $class) {
         $could_be_in_class = 1;
         if (strpos($class, $requested_class) === false) {
             $could_be_in_class = 0;
         } else {
             break;
         }
     }
     if ($could_be_in_class == 0) {
         cust_die("Your student is not in that class.");
     }