File manager - Edit - /usr/local/cpanel/base/frontend/jupiter/cpguard/web_security/waf_data.php
Back
<?php include_once dirname(__DIR__) . "/includes/init.php"; include_once dirname(__DIR__) . "/classes/api.class.php"; $api = new Api($current_user); ## Read value $start = filter_var($_POST['start']); $length = filter_var($_POST['length']); $column_index = filter_var($_POST['order'][0]['column']); // Column index $column_name = filter_var($_POST['columns'][$column_index]['data']); // Column name $column_sort_order = filter_var($_POST['order'][0]['dir']); // asc or desc $request = [ 'page' => ($start / $length) + 1, 'length' => $length, 'sort' => [$column_name => $column_sort_order] ]; ## Search if (!empty($_POST['filter_ip'])) { $request['filter']['ip'] = filter_var($_POST['filter_ip']); } if (!empty($_POST['filter_reason'])) { $request['filter']['reason'] = filter_var($_POST['filter_reason']); } if (!empty($_POST['filter_hostname'])) { $request['filter']['hostname'] = filter_var($_POST['filter_hostname']); } if (!empty($_POST['filter_action'])) { $request['filter']['action'] = filter_var($_POST['filter_action']); } if (!empty($_POST['filter_time_from'])) { $request['filter']['time_from'] = filter_var($_POST['filter_time_from']); } if (!empty($_POST['filter_time_to'])) { $request['filter']['time_to'] = filter_var($_POST['filter_time_to']); } if (!empty($_POST['search']['value'])) { $request['filter']['query'] = filter_var($_POST['search']['value']); } if (!empty($_POST['export'])) { if (!empty($_POST['table_action_ids'])) { $request['filter']['export_ids'] = $_POST['table_action_ids']; } $result = $api->request('wafExport', $request); if (!empty($result)) { ob_start(); header("Cache-Control: no-store"); header("X-Accel-Buffering: no"); header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename="waf_logs.csv"'); $fp = fopen('php://output', 'wb'); fputcsv($fp, ['Rule ID', 'Ip', 'Uri', 'Host Name', 'User', 'Reason', 'Justification', 'HTTP Method', 'HTTP Version', 'HTTP Response', 'Action', 'Time']); ob_flush(); flush(); foreach ($result as $row) { fputcsv($fp, $row, ','); ob_flush(); flush(); } fclose($fp); } } else { $result = $api->request('wafData', $request); ## Response echo json_encode( array( "draw" => isset($_POST['draw']) ? intval(filter_var($_POST['draw'])) : 0, "iTotalRecords" => $result['meta']['total'] ? $result['meta']['total'] : 0, "iTotalDisplayRecords" => $result['meta']['total'] ? $result['meta']['total'] : 0, "aaData" => $result['records'] ? $result['records'] : [] ) ); }
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.04 |
proxy
|
phpinfo
|
Settings