2015-04-06 17:46:57 +02:00
|
|
|
<?php
|
|
|
|
|
2015-04-11 19:32:50 +02:00
|
|
|
$pos = isset($_REQUEST['pos']) ? $_REQUEST['pos'] : '';
|
|
|
|
$lastdate = isset($_REQUEST['lastdate']) ? $_REQUEST['lastdate'] : '';
|
|
|
|
$room = isset($_REQUEST['room']) ? $_REQUEST['room'] : '';
|
|
|
|
$date = date('Y-m-d');
|
|
|
|
$file = './history/'.$room.$date;
|
2015-04-06 17:46:57 +02:00
|
|
|
|
2015-04-11 19:32:50 +02:00
|
|
|
if (!ctype_digit($pos) || !file_exists($file)) return;
|
2015-04-06 17:46:57 +02:00
|
|
|
|
2015-04-11 19:32:50 +02:00
|
|
|
settype($pos, "integer");
|
|
|
|
settype($lastdate, "integer");
|
2015-04-10 23:54:09 +02:00
|
|
|
|
2015-04-11 19:32:50 +02:00
|
|
|
if ($date!=date('Y-m-d',$lastdate)) $pos=0;
|
2015-04-10 23:54:09 +02:00
|
|
|
|
2015-04-06 17:46:57 +02:00
|
|
|
$data = array();
|
2015-04-11 19:32:50 +02:00
|
|
|
$fh =fopen($file, "r");
|
|
|
|
|
|
|
|
if (fseek($fh, $pos)==0) {
|
|
|
|
$i=0;
|
|
|
|
while($lig=fgets($fh)){ $data[$i++] = explode('>', $lig); }
|
|
|
|
$pos =ftell($fh);
|
|
|
|
echo json_encode(array('pos' => $pos, 'data' => $data));
|
2015-04-06 17:46:57 +02:00
|
|
|
}
|
|
|
|
|
2015-04-11 19:32:50 +02:00
|
|
|
?>
|