die; } if ($_GET['act'] == 'get_emails_table_data') { if (!isset($_GET['period'])) { $period = 'lifetime'; } $period = $_GET['period']; //class based implementation require '../classes/dashboard/Emails.php'; $email = new Emails(); $email->setPeriod($period); if ($period == 'custom') { $email->setCustomPeriod($_REQUEST['from'], $_REQUEST['to']); } header('Content-Type: application/json'); echo json_encode($email->get_email_table_data()); die; //non-class based implementation $where = ""; if (!$is_su) { $where = " AND client_id = '" . $client_unbouce_id . "' "; } $rangeArray = getDateRangeFromPeriod($period); $date_from = $rangeArray['date_from']; $date_to = $rangeArray['date_to']; $where .= " AND email_date>='{$date_from}' AND email_date<='{$date_to}' "; $json_array = array(); $sql = "SELECT * FROM emails WHERE 1 {$where} ORDER BY email_date DESC "; $r = $db->Execute($sql); foreach ($r as $res) { $json_array[] = $res;