예제 #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
                } elseif ($info->getAccess() == 1) {
예제 #2
0
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;