}
-//$tip=rand(0,4);
-
-$daysCnt = 2;
-//if (isset($_GET["tip"])) $tip = (int)$_GET["tip"];
-if (!empty($_GET["daysCnt"])) $daysCnt = (int)$_GET["daysCnt"];
+$date1 = date('Y-m-d', strtotime('-1 day', time()));
+$date2 = date('Y-m-d');
+if (!empty($_GET["date1"])) $date1 = $_GET['date1'];
+if (!empty($_GET["date2"])) $date2 = $_GET['date2'];
foreach (range(0,4) as $tip){
- echo "За дней $daysCnt";
+ //echo "За дней $daysCnt";
+ echo "С $date1 по $date2";
- for ($Offset = 0; $Offset <= $daysCnt; $Offset++) {
+ $currDate = $date1;
+ while ($currDate <= $date2) {
$array = array(
'SessionID' => $sid,
'Analytics' => 'CrossingLine',
- 'From' => date("Y-m-d 00:00:00", time() - 86400 * ($Offset)),
- 'To' => date("Y-m-d 23:59:59", time() - 86400 * ($Offset - 1)),
+ 'From' => date("Y-m-d 00:00:00", strtotime($currDate)),
+ 'To' => date("Y-m-d 23:59:59", strtotime($currDate)),
'Direction' => 'Out',
'GroupBy' => 'hour',
'Limit' => 1000
//echo $html;
- $file_put = __DIR__ . "/../../log/xml/ExportReport" . $acc . "_" . $Offset . ".xml";
+ $file_put = __DIR__ . "/../../log/xml/ExportReport" . $acc . "_" . $currDate . ".xml";
file_put_contents($file_put, $html);
//echo"<textarea class=\"form-control\">$html</textarea>";
$filename = 'file_cnt.txt';
- file_put_contents(__DIR__ . '/../../log/text/' . $filename, $Offset . "" . date("Y-m-d H:i:s") . "");
+ file_put_contents(__DIR__ . '/../../log/text/' . $filename, $currDate . "" . date("Y-m-d H:i:s") . "");
if ($all) {
arsort($all);
foreach ($all as $cid => $val) echo "<br> $cid = > $val "; ///".$allcnt[$cid]."
}
+
+ $currDate = date("Y-m-d", strtotime("+1 day", strtotime($currDate)));
}
sleep(2);
}