session_start(); include('common.php'); include('db.php'); if( isset( $_SESSION['user_id'] ) && is_numeric( $_SESSION['user_id'] ) && $_SESSION['user_id'] > 0 ) { if( isset( $_REQUEST['user_id'] ) && $_REQUEST['user_id'] == 0 ) { $_SESSION['user_id'] == 0; $_SESSION['manager_id'] == 0; unset($_SESSION['manager_id'] ); unset($_SESSION['user_id'] ); header('Location: index.php'); } else { $loggedin = true; $user_id = $_SESSION['user_id']; $manager_id = $_SESSION['manager_id']; } } else { if( isset( $_REQUEST['user']) && $_REQUEST['user'] > '' ) { //&& $users[ $_REQUEST['user'] ] == $_REQUEST['user_id'] ) { $username = mysql_escape_string( $_REQUEST['user'] ); $password = mysql_escape_string( $_REQUEST['password'] ); $result = @mysql_query( "SELECT user_id,name,manager_id FROM users WHERE users.name='$username' and password='$password' " ); if( @mysql_num_rows( $result ) == 1 ) { $loggedin = true; $_SESSION['user_id'] = mysql_result( $result, 0, 'user_id' ); $_SESSION['name'] = mysql_result( $result, 0, 'name' ); $_SESSION['manager_id'] = mysql_result( $result, 0, 'manager_id' ); $user_id = $_SESSION['user_id']; } else { $loggedin = false; } } else { $loggedin = false; } } $i = 0; $menu = ""; $studentname = ""; if( $loggedin && $_SESSION['manager_id'] == $_SESSION['user_id'] ) { //Selection menu for choosing a different student. if( isset( $_REQUEST['UUID'] ) && is_numeric( $_REQUEST['UUID'] ) && $_REQUEST['UUID'] > 0 ) { $UID = $_REQUEST['UUID']; } $menu .= "Teacher"; $students = get_students( $manager_id ); $menu .= '