<?php
//========================================================================
// BEGIN: GET THE INPUT VARIABLES
//========================================================================
$date = get_input('date');
$date2 = get_input('date2');
$time = get_input('time');
$time2 = get_input('time2');
$limit = get_input('limit');
$orderby = get_input('orderby');
$order = get_input('order');
$offset = get_input('offset');
if(!$offset){
$offset = 0;
}
$table = get_input('table');
//========================================================================
// END: GET THE INPUT VARIABLES
//========================================================================
//========================================================================
// BEGIN: INPUT VALIDATION
//========================================================================
parseinput('host', 'log_host', true, true);
parseinput('logmsg', 'log_msg', true, true);
parseinput('severity', 'log_sev', true, true);
parsemsginput();
if($date && !validate_input($date, 'date')){
array_push($inputValError, 'date1');
}
if($date2 && !validate_input($date2, 'date')){
array_push($inputValError, 'date2');
}
if($time && !validate_input($time, 'time')){
array_push($inputValError, 'time1');
}
if($time2 && !validate_input($time2, 'time')){
array_push($inputValError, 'time2');
}
if($limit && !validate_input($limit, 'limit')){
array_push($inputValError, 'limit');
}
if($orderby && !validate_input($orderby, 'orderby')){
array_push($inputValError, 'orderby');
}
if($order && !validate_input($order, 'order')){
array_push($inputValError, 'order');
}
if(!validate_input($offset, 'offset')){
array_push($inputValError, 'offset');
}
if($table && !validate_input($table, 'table')){
array_push($inputValError, 'table');
}
if($inputValError){
echo 'Input validation error! The following fields had the wrong format:<p>';
foreach($inputValError as $value){
echo $value, '<br>';
}
require_once(BASE_PATH . '/html_footer.php');
exit;
}
//========================================================================
// END: INPUT VALIDATION
//========================================================================
//========================================================================
// BEGIN: BUILD AND EXECUTE SQL STATEMENT
// AND BUILD PARAMETER LIST FOR HTML GETS
//========================================================================
//------------------------------------------------------------------------
// Create WHERE statement and GET parameter list
//------------------------------------------------------------------------
$where = '';
$ParamsGET = '&';
inputdb('host', 'log_host', 'log_host', true, true);
inputdb('logmsg', 'log_msg', 'log_msg', true, true);
inputdb('severity', 'log_sev', 'log_sev', true, true);
timestampdb('log_time', 'Y-m-d H:i:s');
msginputdb('log_msg');
if($table){
$ParamsGET=$ParamsGET.'table='.$table.'&';
}
if($limit){
$ParamsGET=$ParamsGET.'limit='.$limit.'&';
}
if($orderby){
$ParamsGET=$ParamsGET.'orderby='.$orderby.'&';
}
if($order){
$ParamsGET=$ParamsGET.'order='.$order.'&';
}
if($pageId){
$ParamsGET=$ParamsGET.'pageId='.$pageId.'&';
}
//------------------------------------------------------------------------
// Create the GET string without server variables
//------------------------------------------------------------------------
$pieces = explode('&', $ParamsGET);
$orderParamsGET = '';
foreach($pieces as $value){
if(!strstr($value, 'order=') && !strstr($value, 'orderby=') && !strstr($value, 'offset=') && $value){
$orderParamsGET = $orderParamsGET.$value.'&';
}
}
?>