0) {
$where = "";
// Handle selected date ranges
$start_date = date("Y-m-d 00:00:00",time());
$end_date = date("Y-m-d 23:59:59",time());
if (array_key_exists('start_date',$_POST) && strlen($_POST['start_date']) > 0) $start_date = date("Y-m-d 00:00:00",strtotime($_POST['start_date']));
if (array_key_exists('end_date',$_POST) && strlen($_POST['end_date']) > 0) {
$end_date = $_POST['end_date'];
if ($end_date < substr($start_date,0,10)) {
$end_date = substr($start_date,0,10);
$error_message = getLanguageText('ERRORMSG-INVALID-DATE-RANGE');
}
$end_date = date("Y-m-d 23:59:59",strtotime($end_date));
}
$stime = strtotime($start_date);
$etime = strtotime($end_date);
$where .= "and sent_time between '$stime' and '$etime' ";
$args = "&where=" . urlencode($where);
$args .= "&stime=$stime";
$args .= "&etime=$etime";
$naction = 'list';
header("Location: /?action=$action&naction=$naction$args" . "&error_message=" . urlencode($error_message));
ob_end_clean();
exit();
}
else {
if (array_key_exists('where',$_GET) && strlen($_GET['where']) > 0) {
$where = "where school_num = $school_num " . $_GET['where'];
$stime = intval($_GET['stime']);
$etime = intval($_GET['etime']);
}
else {
$where = "where school_num = $school_num ";
// Handle selected date ranges
$start_date = date("Y-m-d 00:00:00",time());
$end_date = date("Y-m-d 23:59:59",time());
$stime = strtotime($start_date);
$etime = strtotime($end_date);
$where .= "and sent_time between '$stime' and '$etime' ";
}
}
$sdate = date("Y-m-d",$stime);
$edate = date("Y-m-d",$etime);
$message_width = 400;
include "form.messages.php";
$scriptName = str_replace("/m/data1/app.hotlunches.net/","",__FILE__);
include "help.docs.php";
?>