Exemplo n.º 1
0
}
//if we've been to a previous site before
if (isset($option)) {
    if (!empty($_POST['userid'])) {
        if (!empty($_POST['password'])) {
            $pass = hash('sha256', $_POST['password']);
            $result = $db->query("select * from Users where Users.UserID = '{$_POST['userid']}' and Users.password = '******' and Users.access_level >= 0");
            $rows = $result->num_rows;
            if ($rows < 1) {
                show_header();
                echo "User ID and password do not match. Please enter again. You may have been removed from the system</br>";
                get_info();
                show_end();
            } else {
                $row = $result->fetch_array();
                $info = new A2User($row['UserID'], $row['password'], $row['psid'], $row['email'], $row['last_name'], $row['first_name'], $row['access_level']);
                if ($info->getAccess() == 0) {
                    $_SESSION['option'] = "logged_on";
                    $result = $db->query("select * from Courses where Courses.psid = " . $info->getPsid());
                    $rows = $result->num_rows;
                    $studentCourseList = array();
                    for ($i = 0; $i < $rows; $i++) {
                        $course = $result->fetch_array();
                        $studentCourse = new Course($course['Term'], $course['Department'], $course['Class_Number'], $course['Grade'], $course['GPA']);
                        $studentCourseList[$i] = $studentCourse;
                    }
                    $info->addCourses($studentCourseList);
                    $coursesTaken = show_classes($info);
                    show_requirements($coursesTaken);
                    log_out();
                    //if we matched, and we are an advisor. show the info and search option
Exemplo n.º 2
0
//if we've been to a previous site before
if (isset($option)) {
    if (strcmp($option, 'logging_in') == 0) {
        if (!empty($_POST['userid'])) {
            if (!empty($_POST['password'])) {
                $pass = hash('sha256', $_POST['password']);
                $result = $db->query("select * from Users where Users.UserID = '{$_POST['userid']}' and Users.password = '******' and Users.access_level >= 0");
                $rows = $result->num_rows;
                if ($rows < 1) {
                    show_header();
                    echo "User ID and password do not match. Please enter again. You may have been removed from the system</br>";
                    get_info();
                    show_end();
                } else {
                    $row = $result->fetch_array();
                    $info = new A2User($row['UserID'], $row['password'], $row['psid'], $row['email'], $row['last_name'], $row['first_name'], $row['access_level']);
                    if ($info->getAccess() == 0) {
                        // no more refreshes.
                        $_SESSION['option'] = "logged_on";
                        /*
                        $result = $db->query("select * from Courses where Courses.psid = ".$info->getPsid());
                        				
                        $rows = $result->num_rows;
                        					
                        $studentCourseList = array();
                        for ( $i =0; $i < $rows; $i++ )
                        {
                        	$course = $result->fetch_array();
                        
                        	$studentCourse = new Course($course['Term'], $course['Department'], $course['Class_Number'], $course['Grade'], $course['GPA'] );
                        	$studentCourseList[$i] = $studentCourse;
Exemplo n.º 3
0
}
include 'A2Functions.php';
require_once 'A2User.php';
$db = new mysqli('localhost', 'BeersA', "newt.chaps", 'BeersA');
if ($db->connect_error) {
    die("Could not connect to db " . $db->connect_error);
}
if (isset($_POST['type'])) {
    $type = $_POST["type"];
}
if ($type == 1) {
    $setting = $_POST["setting"];
    $psid = $_POST["psid"];
    $result = $db->query("select * from Users where Users.psid = '{$psid}'");
    $row = $result->fetch_array();
    $info = new A2User($row['UserID'], $row['password'], $row['psid'], $row['email'], $row['last_name'], $row['first_name'], $row['access_level']);
    $result = $db->query("select * from Courses where Courses.psid = '{$psid}'");
    $rows = $result->num_rows;
    $studentCourseList = array();
    for ($i = 0; $i < $rows; $i++) {
        $course = $result->fetch_array();
        $studentCourse = new Course($course['Term'], $course['Department'], $course['Class_Number'], $course['Grade'], $course['GPA']);
        $studentCourseList[$i] = $studentCourse;
    }
    $info->addCourses($studentCourseList);
    $infoString = serialize($info);
    if ($setting == 1) {
        $result = show_term_classes($info, $db);
        echo "{$result}";
    } elseif ($setting == 2) {
        $result = show_alpha_classes($info, $db);
Exemplo n.º 4
0
 $psid = $_POST['psid'];
 echo "Seaching for psid of {$psid}<br/>";
 $result = $db->query("select * from Users where Users.psid = '{$_POST['psid']}' and Users.access_level > '-1'");
 $rows = $result->num_rows;
 if ($rows < 1) {
     $infoString = serialize($info);
     $_SESSION['info'] = $infoString;
     echo "First / Last name not found, search again<br/>";
     student_search();
     //prompt search again, didnt find psid
     if ($info->getAccess() == 2) {
         add_remove();
     }
 } else {
     $row = $result->fetch_array();
     $studentInfo = new A2User($row['UserID'], $row['password'], $row['psid'], $row['email'], $row['last_name'], $row['first_name'], $row['access_level']);
     $result = $db->query("select * from Courses where Courses.psid = " . $studentInfo->getPsid());
     $rows = $result->num_rows;
     $studentCourseList = array();
     for ($i = 0; $i < $rows; $i++) {
         $course = $result->fetch_array();
         $studentCourse = new Course($course['Term'], $course['Department'], $course['Class_Number'], $course['Grade'], $course['GPA']);
         $studentCourseList[$i] = $studentCourse;
     }
     $studentInfo->addCourses($studentCourseList);
     $info->addStudent($studentInfo);
     $infoString = serialize($info);
     $_SESSION['info'] = $infoString;
     $coursesTaken = show_classes($studentInfo);
     advisor_action();
 }