@header('Content-type: text/html; charset=utf-8'); $version_php = (float)phpversion(); if($version_php >= 7) $mysqli = new mysqli('localhost', 'dongnudmtb_user', 'dggfgfig56767@', 'dongnudmtb_data'); else { $db = @mysql_connect("localhost","dongnudmtb_user","dggfgfig56767@"); $dbuse = @mysql_select_db("dongnudmtb_data",$db); } if(is_string($mysqli)){ include("config/db_mysql_error.php"); exit(); } if($version_php >= 7) $mysqli->query("SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary"); else mysql_query("SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary"); @date_default_timezone_set('Asia/Saigon'); $domain_main = $_SERVER['SERVER_NAME']; $fullpath = 'https://'.$domain_main; $auto_key_pass = "2u.com.vn"; $check_fl_domain = "localhost"; $_SESSION['sub_demo'] = "/"; $_SESSION['thumuc'] = "content_dongnudaminhthaibinh"; $array_tiennghi = array('Bar', 'BBQ Area', 'Car parking', 'Coffee shop', 'Elevator', 'Event room', 'Fitness center', 'Front desk', 'Guest room', 'Housekeeping', 'Laundry', 'Minimart', 'Motobike parking', 'Playground indoor', 'Playground outdoor', 'Putting green', 'Relax area', 'Restaurant', 'Sauna', 'Security', 'Shop', 'Shuttle bus', 'Spa', 'Steam room', 'Supermarket', 'Swimming pool', "Kid's pool", 'Table tennis', 'Tennis court', 'Yoga'); $pos = strpos($_SERVER['REQUEST_URI'], "nguoiquanly"); $token = '6468EF442F8962959169778Be43e2589e149878d'; if ($pos == false) { require_once 'Mobile_Detect.php'; $detect = new Mobile_Detect; } ?> function MOT_nhay($txt) { return str_replace("'",'"',trim($txt)); } function online() { $rip = $_SERVER['REMOTE_ADDR']; $sd = time(); $count = 1; $maxu = 1; $file1 = "counter/online.log"; $lines = file($file1); $line2 = ""; foreach ($lines as $line_num => $line) { if ($line_num == 0) { $maxu = $line; } else { $fp = strpos($line, '****'); $nam = substr($line, 0, $fp); $sp = strpos($line, '++++'); $val = substr($line, $fp + 4, $sp - ($fp + 4)); $diff = $sd - $val; if ($diff < 300 && $nam != $rip) { $count = $count + 1; $line2 = $line2 . $line; } } } $my = $rip . "****" . $sd . "++++\n"; if ($count > $maxu) $maxu = $count; $open1 = fopen($file1, "w"); fwrite($open1, "$maxu\n"); fwrite($open1, "$line2"); fwrite($open1, "$my"); fclose($open1); $count = $count; $maxu = $maxu + 200; return $count; } function today() { $file_count = fopen('counter/count.txt', 'rb'); $data = ''; while (!feof($file_count)) $data .= fread($file_count, 4096); fclose($file_count); list($today, $yesterday, $total, $date, $days) = explode("%", $data); return $today; } function yesterday() { $file_count = fopen('counter/count.txt', 'rb'); $data = ''; while (!feof($file_count)) $data .= fread($file_count, 4096); fclose($file_count); list($today, $yesterday, $total, $date, $days) = explode("%", $data); return $yesterday; } function total() { $file_count = fopen('counter/count.txt', 'rb'); $data = ''; while (!feof($file_count)) $data .= fread($file_count, 4096); fclose($file_count); list($today, $yesterday, $total, $date, $days) = explode("%", $data); echo $total; } function avg() { $file_count = fopen('counter/count.txt', 'rb'); $data = ''; while (!feof($file_count)) $data .= fread($file_count, 4096); fclose($file_count); list($today, $yesterday, $total, $date, $days) = explode("%", $data); echo ceil($total / $days); } function onlineuser($timeroff = 360, $sidd) { $ipadd = $_SERVER['REMOTE_ADDR']; $baygio = time(); ///$deluser $sql_del = query("delete from phl_online where timer+$timeroff < $baygio"); /// Check user hien tai $sqltim = query("SELECT `uid` FROM phl_online WHERE `sidd`='$sidd'"); if (!num_rows($sqltim)) { $_SESSION['web_user'] = NULL; } ///$them vao hay khong? $sql_tim = query("select uip,sidd from phl_online where uip='$ipadd' and sidd='$sidd'"); $cohaykhong = fetch_array($sql_tim); if ($cohaykhong) { $sql_upd = query("update from phl_online SET timer='$baygio' where uip='$ipadd'"); } else { $sql_them = query("insert into phl_online(uip,sidd,timer) values ('$ipadd','$sidd','$baygio')"); $sql_counter = query("update phl_bodem SET coonter=coonter+1"); } /// xuat ra $sql_show = query("select count(*) as tongso from phl_online"); $sho = fetch_array($sql_show); return $sho['tongso']; } function thongke() { $sql = query("select * from phl_bodem"); $sho = fetch_array($sql); return $sho['coonter']; } function actionDB($array, $table, $type = 'add', $array_remove = array(), $condition = NULL) { global $mysqli; $bang_db = ""; $bang_value = ""; if ($type == 'delete') { $sql_del = $mysqli->query("DELETE FROM $table WHERE $condition"); if ($sql_del) { return true; } } foreach ($array as $key => $value) { if ($type == 'add') { if (is_array($array_remove)) { if (in_array($key, $array_remove)) continue; } $bang_db .= "$key,"; $bang_value .= "'" . PlanText($value) . "',"; } if ($type == 'update') { if (is_array($array_remove)) { if (in_array($key, $array_remove)) continue; } $bang_db .= "`$key`='" . PlanText($value) . "',"; } } $bang_db = substr($bang_db, 0, -1); $bang_value = substr($bang_value, 0, -1); if ($type == 'add') { $mysqli->query("INSERT INTO `$table`($bang_db) VALUES($bang_value)"); return $mysqli->insert_id; } if ($type == 'update') { $mysqli->query("UPDATE $table SET $bang_db WHERE $condition"); return true; } } function Mail_Sender($mailto, $nameto, $subject, $body, $kieu) { //$kieu: 1 - Mail liên hệ; 2 - Mail tour lẻ; 3 - Tour customer; 4 - Tư vấn tour miễn phí; 5 - Mail dang ky đại lý; 6 - Tiếp thị liên kết; 7 - Đặt phòng khách sạn global $mysqli; $body = $mysqli->real_escape_string($body); $array_mailto = explode(';', $mailto); $nameto = explode(';', $nameto); if (count($array_mailto) > 0) { foreach ($array_mailto as $key => $value) { $sql = $mysqli->query("INSERT INTO `phl_mail_sender`(`mailto` ,`nameto` ,`subject` ,`content`,`thoigian` ,`kieu`) VALUES('$value','$nameto[$key]','$subject','$body','" . time() . "','$kieu')"); } } elseif (!empty($mailto)) { $sql = $mysqli->query("INSERT INTO `phl_mail_sender`(`mailto` ,`nameto` ,`subject` ,`content`,`thoigian` ,`kieu`) VALUES('$mailto','$nameto','$subject','$body','" . time() . "','$kieu')"); } } function query($query, $versionphp = '7') { if (VERSIONPHP > 7) { global $mysqli; return @$mysqli->query("$query"); } else { return @mysql_query($query); } } function real_escape_string($str, $versionphp = '7') { if (VERSIONPHP > 7) { global $mysqli; return @$mysqli->real_escape_string($str); } else return @mysql_real_escape_string($str); } function num_rows($db, $versionphp = '7') { if (VERSIONPHP > 7) { return @$db->num_rows; } else { return @mysql_num_rows($db); } } function insert_id($versionphp = '7') { if (VERSIONPHP > 7) { global $mysqli; return @$mysqli->insert_id; } else { return @mysql_insert_id(); } } function fetch_array($db, $versionphp = '7') { if (VERSIONPHP > 7) { return @$db->fetch_array(); } else { return @mysql_fetch_array($db); } } function fetch_assoc($db, $versionphp = '7') { if (VERSIONPHP > 7) { return @$db->fetch_assoc(); } else { return @mysql_fetch_assoc($db); } } function PlanText($text) { return real_escape_string(stripslashes(trim($text))); } function getRouter($option) { $slug = isset($option['slug']) ? $option['slug'] : ''; $more = isset($option['key']) ? " AND `key`='" . $option['key'] . "'" : ''; return query("SELECT * FROM `phl_router` WHERE `slug`='" . $slug . "' $more LIMIT 1"); } function checkIdHaveRouter($option) { $table = isset($option['table']) ? $option['table'] : ''; $more = isset($option['key']) ? " AND `key`='" . $option['key'] . "'" : ''; return query("SELECT * FROM `phl_router` WHERE `table`='" . $table . "' $more LIMIT 1"); } function get_root_cat($id, $cat, $table) { if ($id AND $table == 'phl_baiviet') { $sql = query("SELECT `step` FROM `phl_baiviet` WHERE `pid`='$id'"); $row = fetch_assoc($sql); $step = $row['step']; } if ($cat AND $table == 'phl_danhmuc') { $sql = query("SELECT `step` FROM `phl_danhmuc` WHERE `pid`='$cat'"); $row = fetch_assoc($sql); $step = $row['step']; } return $step; } function get_name_kietxuat_cat($step, $id) { $sql_a = query("SELECT `tieude_vi`, `tieude_en` FROM `phl_danhmuc` WHERE `step`='$step' AND `pid`='$id' AND `trangthai`='1'"); $row = fetch_assoc($sql_a); return $row["tieude_" . $_SESSION["lang"]]; } function get_no_follow($nid, $type = 1) { if ($type == 1) $sql_a = query("SELECT `cindex` FROM `phl_danhmuc` WHERE `pid`='$nid' LIMIT 1"); else $sql_a = query("SELECT `cindex` FROM `phl_baiviet` WHERE `pid`='$nid' LIMIT 1"); $row = fetch_assoc($sql_a); return $row["cindex"]; } function get_id_topic_current($id) { $sql_a = query("SELECT `id_danhmuc` FROM `phl_baiviet` WHERE `pid`='$id' LIMIT 1"); $row = fetch_assoc($sql_a); return $row["id_danhmuc"]; } function get_id_danhmuc($id) { $sql_a = query("SELECT * FROM `phl_baiviet` WHERE `id_danhmuc`='$id' LIMIT 1"); return fetch_assoc($sql_a); } function banner_img($kietxuat, $name) { $sqllogo = query("SELECT * FROM phl_hinhanh WHERE trangthai = 1 AND id_loaihinhanh =" . $kietxuat . " ORDER BY ngaydang DESC LIMIT 1"); $result = fetch_array($sqllogo); return $result["duongdantin"] . '/' . $result["$name"]; } function move_to_url($fullpath, $mess, $url, $title, $tim) ///Chuyen qua 1 URL khac { $f = @file_get_contents("redirect.html"); $a = array($fullpath, $mess, $url, $title, $tim); $b = array("[%FULLPATH%]", "[%CONTENTS%]", "[%REDIRECT%]", "[%TITLE%]", "[%TIME%]"); echo str_replace($b, $a, $f); } function create_pass($pass, $key) { return strtoupper(md5($pass . md5($key)) . sha1($key . sha1($pass))); } function create_key() { $alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; $text = substr(str_shuffle($alphanum), 0, rand(5, 9)); return $text; } function kiem_tra_cap_con($stepid, $nid = 0) { $sql_a = query("SELECT * FROM `phl_danhmuc` WHERE `step`='$stepid' AND `cha`='$nid' ORDER BY `sapxep` ASC LIMIT 1"); $count = num_rows($sql_a); if ($count > 0) return 1; else return 0; } function kiem_tra_bai_viet_chu_de($stepid, $nid = 0) { $sql_a = query("SELECT * FROM `phl_baiviet` WHERE `step`='$stepid' AND `id_danhmuc`='$nid' ORDER BY `pid` DESC LIMIT 1"); $count = num_rows($sql_a); if ($count > 0) return 1; else return 0; } function png2jpg($UploadFile, $NameFile, $duongdantin, $ext) { //new file name once the picture is converted $namepic = time() . rand(1111, 9999) . "_" . str_replace('.', '', $NameFile) . '.jpg'; $converted_filename = "../" . $duongdantin . "/" . $namepic; if ($ext == "png") $new_pic = imagecreatefrompng($UploadFile); if ($ext == "gif") $new_pic = imagecreatefromgif($UploadFile); // Create a new true color image with the same size $w = @imagesx($new_pic); $h = @imagesy($new_pic); $white = imagecreatetruecolor($w, $h); // Fill the new image with white background $bg = @imagecolorallocate($white, 255, 255, 255); @imagefill($white, 0, 0, $bg); // Copy original transparent image onto the new image @imagecopy($white, $new_pic, 0, 0, 0, 0, $w, $h); $new_pic = $white; @imagejpeg($new_pic, $converted_filename); $return = true; @imagedestroy($new_pic); return $namepic; } function chmod_not_ftp($duongdan) { if (!is_dir($duongdantin)) { @mkdir($duongdan); @chmod(755, $duongdan); } } function is_domain($domain) { if (preg_match("/^([0-9a-z\-]{1,}\.)?[0-9a-z\-]{2,}\.([0-9a-z\-]{2,}\.)?[a-z]{2,}$/i", $domain)) { return true; } else { return false; } } function CovertVn($str) { $str = preg_replace("/(à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)/", 'a', $str); $str = preg_replace("/(è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ)/", 'e', $str); $str = preg_replace("/(ì|í|ị|ỉ|ĩ)/", 'i', $str); $str = preg_replace("/(ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)/", 'o', $str); $str = preg_replace("/(ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)/", 'u', $str); $str = preg_replace("/(ỳ|ý|ỵ|ỷ|ỹ)/", 'y', $str); $str = preg_replace("/(đ)/", 'd', $str); $str = preg_replace("/(À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ)/", 'A', $str); $str = preg_replace("/(È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ)/", 'E', $str); $str = preg_replace("/(Ì|Í|Ị|Ỉ|Ĩ)/", 'I', $str); $str = preg_replace("/(Ò|Ó|Ọ|Ỏ|Õ|Ô|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ)/", 'O', $str); $str = preg_replace("/(Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)/", 'U', $str); $str = preg_replace("/(Ỳ|Ý|Ỵ|Ỷ|Ỹ)/", 'Y', $str); $str = preg_replace("/(Đ|đ)/", 'd', $str); $str = preg_replace("/( )/", '-', $str); $str = preg_replace("/%/", 'phan-tram', $str); $str = preg_replace("@[^A-Za-z0-9./\-_]+@i", "", $str); $str = preg_replace("/(--)/", '-', $str); $str = str_replace("/", '-', $str); return strtolower($str); } function name_of_cat($id, $table) { $sql = query("SELECT `tieude_vi` FROM `$table` WHERE `pid`='$id' LIMIT 1"); $row = fetch_assoc($sql); return $row['tieude_vi']; } function get_root_by_step($step, $lang = 'vi') { $sql_a = query("SELECT `tieude_vi`, `tieude_en` FROM `phl_danhmuc` WHERE `pid`='$step' AND `level`='1' LIMIT 1"); $row = fetch_assoc($sql_a); return $row['tieude_vi']; } function kiem_tra_hinh_anh_bai_viet($nid) { $sql = " SELECT pid from phl_baiviet_img where id_danhmuc = " . $nid; $check = query($sql); return fetch_array($check); } function boxdishome_by_doc_2($url, $id, $table, $name, $langone, $step = 1) { $sql = query("SELECT * FROM $table WHERE `cha`='0' AND `step`='$step' ORDER BY `sapxep` ASC"); $box .= ""; return $box; } function member_checkuser($user) { $sql = query("SELECT `pid` FROM `phl_thanhvien` WHERE `tentruycap`='$user' LIMIT 1"); $row = fetch_array($sql); if (num_rows($sql)) { return $row['pid']; } else { return 0; } } function get_name_member($uid, $field = 'hoten') { if ($uid > 0 AND is_numeric($uid)) { $sql = query("SELECT `$field` FROM `phl_thanhvien` WHERE `pid`='$uid' LIMIT 1"); $row = fetch_array($sql); return $row["$field"]; } else return 0; } function create_date3($dater, $l_d, $l_m, $l_y, $l_h, $l_i, $n_d, $n_m, $n_y, $n_h, $n_i) { if (!$dater) $dater = time(); $nowday = date("d", $dater); $nowmon = date("m", $dater); $nowyer = date("Y", $dater); $nowhou = date("H", $dater); $nowmin = date("i", $dater); $nowy = date("Y", time()); $day = ""; $mon = " / "; $yea = " / "; return $day . $mon . $yea . $hou . $min; } function catapath2($url, $cataid, $aid, $cat_db_name, $sp_db_name, $level) { if (is_numeric($cataid) AND $cataid > 0) { $cat = $cataid; } if ($cat) { $cataparent = $cat; $num = 1; do { $sql_sub = query("SELECT `pid`,`tieude_vi`,`tieude_en`,`cha`,`seo_name` FROM `$cat_db_name` WHERE `pid`='$cataparent' limit 1"); while ($rowssub = fetch_array($sql_sub)) { $cataname_vi = $rowssub['tieude_vi']; $cataname_en = $rowssub['tieude_en']; $cataparent = $rowssub['cha']; $cataid = $rowssub['pid']; $seo_name = $rowssub['seo_name']; if ($num == 1) $muiten = NULL; else $muiten = "»"; if ($level == 3) $setcat = "$url/$seo_name/"; elseif ($level == 2) $setcat = "$url/$seo_name/"; elseif ($level == 1) $setcat = "javascript:void(0);"; else { $len1 = query("SELECT `cha` FROM `$cat_db_name` WHERE `pid`='$cataid' LIMIT 1"); $row = fetch_array($len1); $tomco = $row["cha"]; $setcat = "subcat=$tomco&showpro"; } $tx = "$cataname_vi $muiten " . $tx; if ($cataparent == 0) return $tx; $level--; } $num++; } while (1); } } function boxy2($dbtable, $name = 'catalogid', $id = 0, $lang = 'Chọn đề mục', $step = 0, $opt = 0) { if ($opt) $addmo = " AND `chedo`='$opt' "; if ($step) $sql = query("select * from $dbtable where cha=0 $addmo AND trangthai='1' AND `step`='$step' order by sapxep ASC"); else $sql = query("select * from $dbtable where cha=0 $addmo AND trangthai='1' order by tieude_vi ASC"); $box .= ""; return $box; } function boxy($dbtable, $name = 'catalogid', $id = 0, $lang = 'Chọn đề mục', $step = 0) { $sql = query("select * from $dbtable where `cha`='$step' AND trangthai='1' AND `step`='$step' order by sapxep ASC"); $box .= ""; return $box; } function select_box_1($dbtable, $name = 'catalogid', $id = 0, $lang = 'Chọn đề mục') { $sql = query("select * from $dbtable where trangthai='1' order by sapxep ASC"); $box .= ""; return $box; } function member_checkemail($email) { $sql = query("SELECT `pid` FROM `phl_thanhvien` WHERE `email`='$email' LIMIT 1"); $row = fetch_array($sql); if (num_rows($sql) != 0) { return $row["pid"]; } else { return 0; } } function member_checkusername($username) { $sql = query("SELECT `pid` FROM `phl_thanhvien` WHERE `tentruycap`='$username' LIMIT 1"); $row = fetch_array($sql); if (num_rows($sql) != 0) { return $row["pid"]; } else { return 0; } } function boxdishome_gin($url, $id, $table, $name, $langone, $docid = 0) { $sql = query("SELECT * FROM $table WHERE `cha`=0 ORDER BY `sapxep` ASC"); $box .= ""; return $box; } function name_of_chude($id, $cata_table) { if ($id < 1) return 'Tất cả chủ đề sản phẩm'; $sql = query("SELECT `tieude_vi` FROM `$cata_table` WHERE `pid`='$id' LIMIT 1"); $row = fetch_array($sql); return $row["tieude_vi"]; } function sendsmtpmail_test($to_email, $to_name, $subject, $domain, $body, $a = 1) { require_once __DIR__ . '/phpmailer/Exception.php'; require_once __DIR__ . '/phpmailer/PHPMailer.php'; require_once __DIR__ . '/phpmailer/SMTP.php'; //$body = eregi_replace("[\]",'',$body); try { $mail = new PHPMailer\PHPMailer\PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP //$mail->SMTPDebug = 0; // enables SMTP debug information (for testing) $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "mail.anbinhevents.vn"; $mail->Port = 587; // set the SMTP port for the GMAIL server $mail->Username = "no-reply@anbinhevents.vn"; // SMTP account username $mail->Password = "passab123!"; // SMTP account password $mail->CharSet = 'UTF-8'; $frommail = "no-reply@anbinhevents.vn";; $mail->SetFrom($frommail, $domain); $subject = $subject . " - " . date("H:i A | d/m/Y"); $mail->Subject = $subject; $mail->AltBody = $body; // optional, comment out and test $mail->MsgHTML($body); $get_name = explode(";", $to_name); $get_email = explode(";", $to_email); $soluongmail = count($get_email); $mail->AddAddress(trim($to_email, $to_name)); //$mail->AddAddress($to_email,$to_name); //$mail->AddBCC($bcc_email,$bcc_name); $mail->WordWrap = 50; // set word wrap $mail->IsHTML(true); // send as HTML if (!$mail->Send()) { echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo; exit; return 0; } else { return 1; } } catch (Exception $e) { echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo; exit; return 0; } } function sendsmtpmail($to_email, $to_name, $subject, $domain, $body, $attachment = null) { require_once __DIR__ . '/phpmailer/Exception.php'; require_once __DIR__ . '/phpmailer/PHPMailer.php'; require_once __DIR__ . '/phpmailer/SMTP.php'; //$body = eregi_replace("[\]",'',$body); try { $mail = new PHPMailer\PHPMailer\PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPDebug = 0; // enables SMTP debug information (for testing) $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "mail9096.maychuemail.com"; //$mail->Port = 465; // set the SMTP port for the GMAIL server $mail->Username = "no-reply@anbinhevents.vn"; // SMTP account username $mail->Password = "anbinhevents.vn"; // SMTP account password $mail->CharSet = 'UTF-8'; $frommail = "no-reply@anbinhevents.vn";; $mail->SetFrom($frommail, $domain); $subject = $subject . " - " . date("H:i A | d/m/Y"); $mail->Subject = $subject; $mail->AltBody = $body; // optional, comment out and test $mail->MsgHTML($body); $get_name = explode(";", $to_name); $get_email = explode(";", $to_email); $soluongmail = count($get_email); for ($in = 0; $in < $soluongmail; $in++) { if ($in == 0) { if (is_email(trim($get_email[$in]))) { $mail->AddAddress(trim($get_email[$in]), $get_name[$in]); } } else { if (is_email(trim($get_email[$in]))) $mail->AddBCC(trim($get_email[$in]), $get_name[$in]); } } //$mail->AddAddress($to_email,$to_name); //$mail->AddBCC($bcc_email,$bcc_name); $mail->WordWrap = 50; // set word wrap $mail->IsHTML(true); // send as HTML if (!empty($attachment)) { if (file_exists($attachment)) { $mail->AddAttachment($attachment); } } if (!$mail->Send()) { echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo; exit; return 0; } else { return 1; } } catch (Exception $e) { echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo; exit; return 0; } } function sendsmtpmail_admin($to_email, $to_name, $subject, $domain, $body, $attachment = null) { require_once __DIR__ . '/phpmailer/Exception.php'; require_once __DIR__ . '/phpmailer/PHPMailer.php'; require_once __DIR__ . '/phpmailer/SMTP.php'; //$body = eregi_replace("[\]",'',$body); try { $mail = new PHPMailer\PHPMailer\PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP //$mail->SMTPDebug = 0; // enables SMTP debug information (for testing) $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "smtp.gmail.com"; $mail->Port = 587; // set the SMTP port for the GMAIL server $mail->Username = "alert@dtptech.com.vn"; // SMTP account username $mail->Password = "phuong1988"; // SMTP account password $mail->CharSet = 'UTF-8'; $frommail = "no-reply@dtptech.com.vn";; $mail->SetFrom($frommail, $domain); $subject = $subject . " - " . date("H:i A | d/m/Y"); $mail->Subject = $subject; $mail->AltBody = $body; // optional, comment out and test $mail->MsgHTML($body); $get_name = explode(";", $to_name); $get_email = explode(";", $to_email); $soluongmail = count($get_email); for ($in = 0; $in < $soluongmail; $in++) { if ($in == 0) { if (is_email(trim($get_email[$in]))) { $mail->AddAddress(trim($get_email[$in]), $get_name[$in]); } } else { if (is_email(trim($get_email[$in]))) $mail->AddBCC(trim($get_email[$in]), $get_name[$in]); } } //$mail->AddAddress($to_email,$to_name); //$mail->AddBCC($bcc_email,$bcc_name); $mail->WordWrap = 50; // set word wrap $mail->IsHTML(true); // send as HTML if (!empty($attachment)) { if (file_exists($attachment)) { $mail->AddAttachment($attachment); } } if (!$mail->Send()) { echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo; exit; return 0; } else { return 1; } } catch (Exception $e) { echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo; exit; return 0; } } function uploadImage($file, $dir, $file_name_body_pre, $file_new_name_body, $file_name_body_add, $image_resize = true, $image_ratio_fill, $img_width, $img_height, $image_background_color) { require_once('config/class.upload.php'); $handle = new Upload($file); if ($handle->uploaded) { $_dir = $dir; $handle->file_name_body_pre = $file_name_body_pre; $handle->file_new_name_body = $file_new_name_body; $handle->file_name_body_add = $file_name_body_add; $handle->image_resize = $image_resize; $handle->image_ratio_fill = $image_ratio_fill; $handle->image_x = $img_width; $handle->image_y = $img_height; $handle->image_background_color = $image_background_color; $handle->Process($_dir); if ($handle->processed) { $name_img = $handle->file_dst_name; return $name_img; } else { return false; } } } function company_info($id) { $sql_1 = query("SELECT * FROM `phl_company` WHERE `pid`=" . $id . " LIMIT 1"); $row_1 = fetch_array($sql_1); return stripslashes($row_1['noidung_' . $_SESSION['lang']]); } function company_title($id) { $sql_1 = query("SELECT * FROM `phl_company` WHERE `pid`=" . $id . " LIMIT 1"); $row_1 = fetch_array($sql_1); return stripslashes($row_1['tieude_' . $_SESSION['lang']]); } function lienket($id) { $sql_1 = query("SELECT * FROM `phl_lienket` WHERE `pid`=" . $id . " LIMIT 1"); $row_1 = fetch_array($sql_1); return stripslashes($row_1['link']); } function banner_title($kietxuat) { $sqllogo = query("SELECT `tieude_vi`, `tieude_en` FROM phl_hinhanh WHERE trangthai = 1 AND id_loaihinhanh =" . $kietxuat . " ORDER BY ngaydang DESC LIMIT 1"); $result = fetch_array($sqllogo); return stripslashes($result['tieude_' . $_SESSION['lang']]); } function banner_link($kietxuat) { $sqllogo = query("SELECT `webnguon_vi`, `webnguon_en` FROM phl_hinhanh WHERE trangthai = 1 AND id_loaihinhanh =" . $kietxuat . " ORDER BY ngaydang DESC LIMIT 1"); $result = fetch_array($sqllogo); return stripslashes($result['webnguon_' . $_SESSION['lang']]); } function Flang($str = '') { global $mysqli; $str = trim($str); $sql = "select * from phl_ngonngu where code_lang='" . $str . "' limit 0,1"; $result = query($sql); $rows = fetch_assoc($result); if (!empty($rows)) { if (!isset($_SESSION["lang"])) $_SESSION["lang"] = 'en'; return $rows['lang_' . $_SESSION["lang"]]; } } function findStart($page, $limit) { if (empty($page) || $page == "1") { $start = 0; $page = 1; } else { $start = ($page - 1) * $limit; } return $start; } function findPages($count, $limit) { $pages = (($count % $limit) == 0) ? $count / $limit : floor($count / $limit) + 1; return $pages; } function pageList($current, $total_row, $ctr_name, $ancho) { $div = 10; $row_per_page = 1; if (empty($current)) $current = 1; $npage = floor($total_row / $row_per_page) + (($total_row % $row_per_page) ? 1 : 0); $nDiv = floor($npage / $div) + (($npage % $div) ? 1 : 0); $currentDiv = floor($current / $div); $count = ($npage <= ($currentDiv + 1) * $div) ? ($npage - $currentDiv * $div) : $div; $str_paging = ''; if ($npage > 0) { $npage = intval($total_row / $row_per_page); if ($total_row % $row_per_page > 0) $npage += 1; if ($npage > 1) { if ($current != 1) { /*if (($current != 1) && ($current)) { $str_paging .= '