You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

30 lines
1.0 KiB

<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
//$TZ = new DateTimeZone( date_default_timezone_get() );
//$DT = new DateTime("now", $TZ );
//$DIDI = $TZ->getOffset( $DT );
if(isset($_POST['STATION'])){
$STT = intval( $_POST['STATION'] );
$QS = "SELECT DISTINCT FROM_UNIXTIME( `ts`,'%Y-%m-%d' ) AS `d` FROM `sessions` WHERE `track_id` IN (SELECT DISTINCT `id` FROM `metro_tracks` WHERE `platform_id` IN ( SELECT DISTINCT `id` FROM `metro_platforms` WHERE `station_id`={$STT}))";
} else {
$QS = "SELECT DISTINCT FROM_UNIXTIME( `ts`,'%Y-%m-%d' ) AS `d` FROM `sessions`";
};
$RR = $DATABASE->Query( $QS );
if( count( $RR ) ){
$DD = array();
foreach( $RR as $R ){
$CC = 40; //intval( $R['s_cnt'] );
$DS = $R['d'] . ' 00:00:00';
$TS = strtotime( $DS );//+$DIDI;
if( $CC > 100 ) $CC = 100;
$DD[] = '{"t": '.( $TS * 1000 ).',"v":'.$CC.', "d":"'.$DS.'"}';
};
echo "[" . implode(",", $DD ) . "]";
} else {
echo "[]";
};
} else {
header('location: /');
};
?>