stats-fe.php
changeset 43 ce2e9caf2dfa
parent 36 a7d884914a74
child 44 73f74d395f95
equal deleted inserted replaced
42:c24a2311f232 43:ce2e9caf2dfa
   104   }
   104   }
   105   return false;
   105   return false;
   106 }
   106 }
   107 
   107 
   108 /**
   108 /**
       
   109  * Raw data.
       
   110  * @param string Channel name
       
   111  * @param int How many minutes, defaults to 60
       
   112  * @param int Base time, defaults to right now
       
   113  * @return array MySQL rows.
       
   114  */
       
   115 
       
   116 function stats_raw_data($channel, $mins = 60, $base = NOW)
       
   117 {
       
   118   $channel = db_escape($channel);
       
   119   $time_min = $base - ( $mins * 60 );
       
   120   $time_max =& $base;
       
   121   $total = 0;
       
   122   
       
   123   if ( $q = eb_mysql_query("SELECT * FROM stats_messages WHERE channel = '$channel' AND time >= $time_min AND time <= $time_max ORDER BY message_id ASC;") )
       
   124   {
       
   125     $userdata = array();
       
   126     while ( $row = @mysql_fetch_assoc($q) )
       
   127     {
       
   128       $userdata[] = $row;
       
   129     }
       
   130     return $userdata;
       
   131   }
       
   132   return false;
       
   133 }
       
   134 
       
   135 /**
   109  * Return the time that the stats DB was last updated.
   136  * Return the time that the stats DB was last updated.
   110  * @return int
   137  * @return int
   111  */
   138  */
   112 
   139 
   113 function stats_last_updated()
   140 function stats_last_updated()