Data['id'] > 1 ){ $ZIZI = new SQLite_DB( $SYSPath . '/lib/controller/data/reports/stat.db'); $TZ = new DateTimeZone( date_default_timezone_get() ); $DT = new DateTime("now", $TZ ); $DIDI = $TZ->getOffset( $DT ); $QS = "SELECT * FROM `days`"; $RR = $ZIZI->Query( $QS ); if( count( $RR ) ){ $DD = array(); foreach( $RR as $R ){ $CC = intval( $R['evt_count'] ); // Day key = local noon of the day in the host time zone: maps back to the same date on the // server in any time zone, and shows the right day in a browser within 12 h of the host $DS = sprintf( "%04d-%02d-%02d 12:00:00", intval( $R['year'] ), intval( $R['month'] ), intval( $R['day'] ) ); $TS = strtotime( $DS ); if( $CC > 100 ) $CC = 100; $DD[] = '{"t": '.( $TS * 1000 ).',"v":'.$CC.'}'; //echo '[{"t": 1285891200000,"v": 20},{"t": 1285804800000,"v": 100},{"t": 1672249854000,"v": 50},{"t": 1672279854000,"v": 80}]'; }; echo "[" . implode(",", $DD ) . "]"; } else { echo "[]"; }; } else { header('location: /'); }; ?>