<?
header("Content-type: text/json");
$group_id=(isset($_GET['group_id']))? $_GET['group_id']:0 ;
$event_id=(isset($_GET['event_id']))? $_GET['event_id']:0 ;
$i=5 ;
$arr_cont=array() ;
while($i and $text=get_event_mess($group_id,$event_id,$i))
{   $arr_cont[]=json_decode($text) ;
    $i-- ;
    $event_id++; ;
}
$out=json_encode($arr_cont) ;
echo $out ;


function get_event_mess($group_id,$event_id,$i)
{   //$fname=$_SERVER['DOCUMENT_ROOT'].'/storage/monitor_kt/evt_'.$group_id.'_'.$event_id.'.json' ;
    $fname=$_SERVER['DOCUMENT_ROOT'].'/storage/monitor_kt/evt_'.$event_id.'.json' ;
    if (file_exists($fname))
    { $cont=file_get_contents($fname) ;
      return($cont) ;
    } else return('') ;
}

?>