File size: 667B
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/system/App.php');
set_time_limit(0);
$dataSourceDir = ROOT.'/AJAX/updates/user_'.$me['id'];
$dataSourceFile = $dataSourceDir.'/notifycations.tmp';
while(true)
{
$lastAjaxCall = isset($_GET['timestamp']) ? (int) $_GET['timestamp'] : null;
$dataTime = filetime($dataSourceTime);
clearstatcache();
if($lastAjaxCall == null || $dataTime > $lastAjaxCall)
{
$data = file_get_contents($dataSourceFile);
$json = ['response' => $data, 'timestamp' => $dataTime];
echo json_encode($result);
break;
}
else
{
sleep(1);
continue;
}
}