| Server IP : 64.202.187.69 / Your IP : 216.73.217.33 Web Server : Apache System : Linux 69.187.202.64.host.secureserver.net 3.10.0-1160.144.1.el7.tuxcare.els6.x86_64 #1 SMP Fri May 29 16:22:24 UTC 2026 x86_64 User : transmarket ( 1001) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/transmarket/testadministrator/controllers/ |
Upload File : |
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include 'connection.php';
$requestData = $_REQUEST;
$columns = array(
// 0 => 'au.telegram_username',
0 => 'tl.language_name',
1 => 'fl.language_name',
2 => 'au.original_text',
3 => 'au.translated_text',
4 => 'au.user_suggestion',
5 => 'au.created_at',
);
$sql = 'SELECT au.*, tl.language_name as to_lang_name, fl.language_name as from_lang_name FROM `tbl_machine_translations` as au LEFT JOIN language_code as tl on tl.code=au.to_language LEFT JOIN language_code as fl on fl.code= au.from_language where 1';
if (!empty($requestData['search']['value'])) { // if there is a search parameter, $requestData['search']['value'] contains search parameter
$sql.=" and (fl.language_name LIKE '" . $requestData['search']['value'] . "%' ";
$sql.=" OR tl.language_name LIKE '%" . $requestData['search']['value'] . "%' ";
$sql.=" OR au.original_text LIKE '%" . $requestData['search']['value'] . "%' ";
$sql.=" OR au.translated_text LIKE '%" . $requestData['search']['value'] . "%' ";
$sql.=" OR au.user_suggestion LIKE '%" . $requestData['search']['value'] . "%' ) ";
}
$result = $mysqli->query($sql);
$totalData = $result->num_rows;
$totalFiltered = $totalData;
$sql.= " ORDER BY " . $columns[$requestData['order'][0]['column']] . " " . $requestData['order'][0]['dir'] . " LIMIT " . $requestData['start'] . " ," . $requestData['length'] . " ";
$result = $mysqli->query($sql);
$data = array();
while ($row = $result->fetch_object()) { // preparing an array
$nestedData = array();
// $nestedData[] = '<input type="checkbox" name="multiDelete[]" class="sh-checkbox" data-id="' . $row->id . '">';
// $nestedData[] = mb_convert_encoding(stripslashes($row->telegram_username), "HTML-ENTITIES", "UTF-8");
$nestedData[] = mb_convert_encoding(stripslashes($row->from_lang_name), "HTML-ENTITIES", "UTF-8");
$nestedData[] = mb_convert_encoding(stripslashes($row->to_lang_name), "HTML-ENTITIES", "UTF-8");
$nestedData[] = mb_convert_encoding(stripslashes($row->original_text), "HTML-ENTITIES", "UTF-8");
$nestedData[] = mb_convert_encoding(stripslashes($row->translated_text), "HTML-ENTITIES", "UTF-8");
$nestedData[] = mb_convert_encoding(stripslashes($row->user_suggestion), "HTML-ENTITIES", "UTF-8");
$nestedData[] = $row->created_at;
$data[] = $nestedData;
}
$json_data = array(
"draw" => intval($requestData['draw']), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
"recordsTotal" => intval($totalData), // total number of records
"recordsFiltered" => intval($totalFiltered), // total number of records after searching, if there is no searching then totalFiltered = totalData
"data" => $data, // total data array
"data1" => $requestData['start'], // total data array
"data2" => $requestData['length'], // total data array
// "data3" => $draw // total data array
);
echo json_encode($json_data); // send data as json format