foreach ($r as $res) { $json_array[] = $res; } header('Content-Type: application/json'); echo json_encode($json_array); die; } if ($_GET['act'] == 'get_email_data_weekday') { if (!isset($_GET['period'])) { $period = 'lifetime'; } else { $period = $_GET['period']; } require '../classes/dashboard/Emails.php'; $emails = new Emails(); $emails->setPeriod($period); if ($period == 'custom') { $emails->setCustomPeriod($_REQUEST['from'], $_REQUEST['to']); } $data = $emails->get_weekday_stats(); header('Content-Type: application/json'); echo json_encode($data); die; } //////////////////////////////////////////////////////////////////////////// // SMS //////////////////////////////////////////////////////////////////////////// if ($_GET['act'] == 'get_sms_data') { if (!isset($_GET['period'])) { $period = 'lifetime'; }