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 .= '
'; $menu .= ' (Inclusive) Format: YYYY-MM-DD'; } else { $UID = $user_id; } if( isset( $UID ) ) { $goals1 = array(0,0,0,0,0); $goals2 = array(0,0,0,0,0); switch( $_REQUEST['OP'] ) { case 'add': $op = '+'; $operation = 'Addition'; break; case 'mul': $op = 'X'; $operation = 'Multiplication'; break; default: echo "Invalid Operation"; return 0; } if( !isset( $_REQUEST['startdate']) || !isset( $_REQUEST['stopdate'] ) ) { echo "No dates set."; return 0; } $startdate = $_REQUEST['startdate']; $stopdate = $_REQUEST['stopdate']; $sql = "SELECT math_attempts.user_id, score, duration, title FROM `math_attempts` "; $sql .= "WHERE user_id = '$UID' AND title LIKE '%$op%' AND score > 90 "; $sql .= " AND date(`when`) >= '$startdate' AND date(`when`) <= '$stopdate' "; $sql .="ORDER BY title,duration ASC, score DESC"; //echo $sql.'
'; $table1 = array(); $result = mysql_query( $sql ); $prev = ''; for( $i=0; $i <= 12; $i++ ) { for( $j=0; $j <= 12; $j++ ) { $table1[$i][$j] = 0; } } $i=0; while( $row = mysql_fetch_assoc( $result ) ) { //Unfortunately MYSQL doesn't have a first operator. if( $prev != $row['title'] ) { $prev = $row['title']; $t = explode( $op, $row['title'] ); $left = explode( ':', $t[0] ); $right = explode( ':', $t[1] ); $nproblems = $left[1] * $right[1]; $g = floor( $row['duration']/1000/$nproblems ); if( $g > 4) { $g = 4; } if( $g < 1) { $g = 1; } $table1[ $left[1]][ $right[1] ] = $g; $goals1[ $g ]++; } } //$sql = "SELECT attempts.user_id, score, duration, title FROM `attempts` WHERE user_id = '$UID' AND title LIKE '%$op%' AND score > 90 ORDER BY title,score DESC,duration ASC"; $sql = "SELECT math_attempts.user_id, score, duration, title FROM `math_attempts` "; $sql .= "WHERE user_id = '$UID' AND title LIKE '%$op%' AND score > 90 "; $sql .="ORDER BY title,duration ASC, score DESC"; //echo $sql.'
'; $table2 = array(); $result = mysql_query( $sql ); $prev = ''; for( $i=0; $i <= 12; $i++ ) { for( $j=0; $j <= 12; $j++ ) { $table2[$i][$j] = 0; } } $i=0; //Search through the results and find the lowest attempt time. while( $row = mysql_fetch_assoc( $result ) ) { //Unfortunately MYSQL doesn't have a first operator. if( $prev != $row['title'] ) { $prev = $row['title']; $t = explode( $op, $row['title'] ); $left = explode( ':', $t[0] ); $right = explode( ':', $t[1] ); $nproblems = $left[1] * $right[1]; $g = floor( $row['duration']/1000/$nproblems ); if( $g > 4) { $g = 4; } if( $g < 1) { $g = 1; } $table2[ $left[1]][ $right[1] ] = $g; $goals2[ $g ]++; } } } ?> ASchool.us's Math Facts Service
MathFacts Menu:
Username:
Password:

Math Facts empowering students and teachers to learn more efficiently.

Learn more about the Math Facts Service.
Math Facts is currently in beta testing. If you are interested in using this service you may sign up here

Check out the help page to get a feel for what it looks like.

Admin Menu:
   Reports

Teacher Menu:
   Overview
   Reports
   Class Roster
   CSV Data:
Comma separated format that can be imported to Access, Excel or any other spreadsheet or database program. This will allow you to make your own custom reports. Times in this format are accurate to the hundredth of a second.

'.$fastest.'
'; } echo $menu; ?>
Report for: from to
Key:
Note that the accuracy must be above 90%
DescriptionColor Date range  Total 
No attempt yet 0
less than 2 sec 1
less than 3 sec 2
less than 4 sec 3
greater than 4 sec 4


'; echo ''; for( $l2=1; $l2 < 13; $l2++ ) { echo ''; } echo ''; for( $l2=2; $l2 < 13; $l2++ ) { echo ''; for( $r2=1; $r2 < 13; $r2++ ) { echo '\n"; } echo ''; } echo '
'.$l2.'
'.$l2.''.$table1[$l2][$r2].''."
'; echo '
'; echo '
'; echo 'Current table
'; echo ''; for( $l2=1; $l2 < 13; $l2++ ) { echo ''; } echo ''; for( $l2=2; $l2 < 13; $l2++ ) { echo ''; for( $r2=1; $r2 < 13; $r2++ ) { echo '\n"; } echo ''; } echo '
'.$l2.'
'.$l2.''.$table2[$l2][$r2].''."
'; echo '
'; echo $attempts; echo '
'; echo ''; echo "
\n"; ?>
Logout