<?php
//$timestart=null;
//$timestop=null;
$start = $_GET['start'];
$stop = $_GET['stop'];
$task = !empty($_GET['task']) ? $_GET['task'] : "Task not filled" ;
$timestart = !empty($_GET['timestart']);
$timestop = !empty($_GET['timestop']);
$timesjson = !empty($_GET['times']) ? $_GET['times'] : "10:00-19:00";
  $days = array();
  $times = array();
  $date = strtotime($start);
  $stopwhile = strtotime($stop);
  while($date<=$stopwhile){
    if(date("w", $date)!=6&&date("w", $date)!=0){
      array_push($days,date("d.m.Y", $date));
        if($timesjson!=null)
          array_push($times,$timesjson);
        else
          array_push($times,$timestart."-".$timestop);
    }
    $date+=86400;
  }
  $data = array(
    'task' => $task,
    'days' => $days,
    'times' => $times
  );
  print_r(json_encode($data));
?>