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'] ); //echo "SELECT user_id,username,manager_id FROM users WHERE users.username='$username' and password='$password' "; $result = mysql_query( "SELECT user_id,username,manager_id FROM users WHERE users.username='$username' and password='$password' " ); if( mysql_num_rows( $result ) == 1 ) { $loggedin = true; $_SESSION['user_id'] = mysql_result( $result, 0, 'user_id' ); $_SESSION['username'] = mysql_result( $result, 0, 'username' ); $_SESSION['manager_id'] = mysql_result( $result, 0, 'manager_id' ); $user_id = $_SESSION['user_id']; } else { $loggedin = false; //echo 'here'; } } else { $loggedin = false; } } $attempts = ''; $fastest = ''; /* $sql = 'select min( duration ) as duration, score, title from attempts where score >= 90 and not ( `title` LIKE \'incorrect%\' or `title` LIKE \'slowest%\') group by title order by title;'; $result = mysql_query( $sql ); $fastest .= ''; $fastest .= ''; $fastest .= ''; $i=0; while ($row = mysql_fetch_assoc($result)) { $fastest .= ''; $fastest .= ''; $i++; } $fastest .= '
Fastest times system wide.
UserScoreDuration
Min:Sec
'; $fastest .= $row["title"]; $fastest .= ''; $fastest .= ($row["score"]).'%   '; $fastest .= ''; $fastest .= format_time( $row["duration"]/1000 ).'   '; $fastest .= '
'; */ $i = 0; if( $loggedin && $_SESSION['manager_id'] == $_SESSION['user_id'] ) { $sql = 'SELECT users.user_id,`username`,`when`,duration,score,title '; $sql .= 'FROM users JOIN math_attempts USING (user_id) '; $sql .= 'WHERE `when` > CURRENT_DATE() AND manager_id=\''.$_SESSION['manager_id'].'\' '; $sql .= 'ORDER BY `username`,`when` '; $result = mysql_query( $sql ); $attempts .= ''; $attempts .= ''; $attempts .= ''; $i=0; while ($row = mysql_fetch_assoc($result)) { $attempts .= ''; $i++; } $attempts .= '
Attempts made today
UserTitleScoreDuration
Min:Sec
  '; $attempts .= ''; $attempts .= $row["username"].''; $attempts .= ''; $attempts .= $row["title"]; $attempts .= ''; $attempts .= ($row["score"]).'%   '; $attempts .= ''; $attempts .= format_time( $row["duration"]/1000 ).'   '; $attempts .= '
'; } else { //ADD USER ATTEMPTS LIST HERE. } $attempts .= ' '; $sql = "SELECT math_attempts.user_id, score, duration, title FROM `math_attempts` WHERE user_id = '$user_id' AND title LIKE '%X%' AND score >= 90 ORDER BY title,duration ASC, score DESC"; $sql = "select L.user_id,title,minimum_current,minimum_past FROM (select user_id, title, MIN(minimum_current) as minimum_current from ( select user_id, title, AVG( response_time) as minimum_current from math_attempts join math_responses using (aid) where user_id='$user_id' and score >= 90 and title like '%X%' group by aid ) as current group by title ) as L left join (select user_id, title, MIN(minimum_past) as minimum_past from ( select user_id, title, AVG( response_time) as minimum_past from math_attempts join math_responses using (aid) where user_id='$user_id' and score >= 90 and title like '%X%' and `when` < curdate() group by aid ) as current group by title ) as R using (title) order by title"; //echo $sql.'
'; $mult_table_cur = array(); $mult_table_past = array(); $result = mysql_query( $sql ); $prev = ''; for( $i=0; $i <= 12; $i++ ) { for( $j=0; $j <= 12; $j++ ) { $mult_table_cur[$i][$j] = 0; $mult_table_past[$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( 'X', $row['title'] ); $left = explode( ':', $t[0] ); $right = explode( ':', $t[1] ); $nproblems = $left[1] * $right[1]; $g = floor( $row['minimum_current']/1000/$nproblems ); $g = floor( $row['minimum_current']/1000 ); if( $g > 4) { $g = 4; } if( $g < 1) { $g = 1; } $mult_table_cur[ $left[1]][ $right[1] ] = $g; $g = floor( $row['minimum_past']/1000/$nproblems ); if( $row['minimum_past'] == '' ) { $g = 0; } else { $g = floor( $row['minimum_past']/1000 ); if( $g > 4) { $g = 4; } if( $g < 1) { $g = 1; } } $mult_table_past[ $left[1]][ $right[1] ] = $g; } } //print_r( $mult_table_past ); //$sql = "SELECT math_attempts.user_id, score, duration, title FROM `math_attempts` WHERE user_id = '$user_id' AND title LIKE '%+%' AND score >= 90 ORDER BY title,duration ASC, score DESC"; //$sql = "select L.user_id,title,minimum_current,minimum_past FROM (select user_id, title, MIN(minimum_current) as minimum_current from ( select user_id, title, AVG( response_time) as minimum_current from math_attempts join math_responses using (aid) where user_id='$user_id' and score >= 90 and qtype = '+' group by aid ) as current group by title ) as L left join (select user_id, title, MIN(minimum_past) as minimum_past from ( select user_id, title, AVG( response_time) as minimum_past from math_attempts join math_responses using (aid) where user_id='$user_id' and score >= 90 and qtype = '+' and `when` < curdate() group by aid ) as current group by title ) as R using (title)"; $sql = "SELECT L.user_id,title,minimum_current,minimum_past "; $sql .= "FROM (SELECT user_id, title, MIN(minimum_current) as minimum_current FROM "; $sql .= "( SELECT user_id, title, AVG( response_time) AS minimum_current "; $sql .= "FROM math_attempts join math_responses using (aid) "; $sql .= "WHERE user_id='$user_id' AND score >= 90 AND title like '%+%' group by aid ) AS current "; $sql .= "group by title ) AS L "; $sql .= "LEFT JOIN (SELECT user_id, title, MIN(minimum_past) AS minimum_past "; $sql .= "FROM ( SELECT user_id, title, AVG( response_time) AS minimum_past "; $sql .= "FROM math_attempts join math_responses using (aid) "; $sql .= "WHERE user_id='$user_id' AND score >= 90 AND title like '%+%' AND `when` < curdate() "; $sql .= "group by aid ) AS current "; $sql .= "group by title ) AS R "; $sql .= "using (title) "; $sql .= "order by title"; $sql = "select L.user_id,title,minimum_current,minimum_past FROM (select user_id, title, MIN(minimum_current) as minimum_current from ( select user_id, title, AVG( response_time) as minimum_current from math_attempts join math_responses using (aid) where user_id='$user_id' and score >= 90 and title like '%+%' group by aid ) as current group by title ) as L left join (select user_id, title, MIN(minimum_past) as minimum_past from ( select user_id, title, AVG( response_time) as minimum_past from math_attempts join math_responses using (aid) where user_id='$user_id' and score >= 90 and title like '%+%' and `when` < curdate() group by aid ) as current group by title ) as R using (title) order by title"; //echo '
'.$sql.'
'; $add_table_cur = array(); $add_table_past = array(); $result = mysql_query( $sql ); $prev = ''; for( $i=0; $i <= 12; $i++ ) { for( $j=0; $j <= 12; $j++ ) { $add_table_cur[$i][$j] = 0; $add_table_past[$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( '+', $row['title'] ); $left = explode( ':', $t[0] ); $right = explode( ':', $t[1] ); $nproblems = $left[1] * $right[1]; //$g = floor( $row['minimum_current']/1000/$nproblems ); $g = floor( $row['minimum_current']/1000 ); //echo $row['minimum_current'].' '.$g.' '; if( $g > 4) { $g = 4; } if( $g < 1) { $g = 1; } $add_table_cur[ $left[1]][ $right[1] ] = $g; /* $g = floor( $row['minimum_past']/1000/$nproblems ); $g = floor( $row['minimum_past']/1000); if( $g > 4) { $g = 4; } if( $g < 1) { $g = 1; } */ if( $row['minimum_past'] == '' ) { $g = 0; } else { $g = floor( $row['minimum_past']/1000 ); if( $g > 4) { $g = 4; } if( $g < 1) { $g = 1; } } $add_table_past[ $left[1]][ $right[1] ] = $g; } } //echo var_dump( $add_table_past ); //echo var_dump( $add_table_cur ); ?> 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.

Check out the new version here Apps@ASchool.us. The new version includes subtraction and division. If you already have an account in the old version you can also use it to log into the new version.

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

Admin Menu:
   Reports

Help
Teacher Menu:
   Reports
   Grid Report
   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.'
'; } ?> Activities:
Click the square to start an activity of that size.

Key:
Note that the accuracy must be above 90%
No attempt yet 0 Multiplication Addition
less than 2 sec 1
less than 3 sec 2
less than 4 sec 3
greater than 4 sec 4

'; 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 '
Multiplication:
'.$l2.'
'.$l2.'Go'."
'; echo ''; echo 'Addition
'; $op = '%2B'; 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.'Go'."
'; echo ''; echo $attempts; echo ''; echo ''; ?>
Logout