Thứ Năm, 26 tháng 2, 2026

Gửi Mail SMTP

 1️⃣ Tải bản 5.2.27

Link tải trực tiếp:
https://github.com/PHPMailer/PHPMailer/archive/refs/tags/v5.2.27.zip

Upload 2 file:

class.phpmailer.php
class.smtp.php

Ghi đè lên bản cũ.

tải file: tại đây

Thứ Tư, 11 tháng 2, 2026

Tab 3 cấp nhóm nghanhnghe


 
// ===== LẤY TOÀN BỘ MODULE =====

    $sql = "SELECT mid, title, parentid FROM ".$catalog."_module ORDER BY id";

    $rs  = $db->sql_query($sql);

    $modules = array();

    while ($row = $db->sql_fetchrow($rs)) {

        $modules[] = $row;

    }


    echo '<div class="grid-notfor-supp">';


        // ===== CẤP 1: GIAN HÀNG =====

        echo '<select id="gian_hang" name="gian_hang" required>

                <option value="">-- Gian hàng --</option>';


                foreach($modules as $row){

                    if($row["parentid"] == 0){

                        echo '<option value="'.$row["mid"].'">'.$row["title"].'</option>';

                    }

                }


        echo '</select>';


        // ===== CẤP 2: TAB CHA =====

        echo '<select id="tab_cha" name="tab_cha" disabled required>

            <option value="">-- Tab cha --</option>';

            foreach($modules as $row){

                if($row["parentid"] != 0){

                    echo '<option value="'.$row["mid"].'" data-parent="'.$row["parentid"].'">'.$row["title"].'</option>';

                }

            }

        echo'</select>';


        // ===== CẤP 3: TAB CON =====

        echo'<select id="tab_con" name="tab_con" disabled required>

            <option value="">-- Tab con --</option>';

            foreach($modules as $row){

                if($row["parentid"] != 0){

                    echo '<option value="'.$row["mid"].'" data-parent="'.$row["parentid"].'">'.$row["title"].'</option>';

                }

            }

        echo'</select>';


    echo '</div>';


    echo '<div class="error" id="errorMsg">

        ⚠ Vui lòng chọn đầy đủ Gian hàng, Tab cha và Tab con

    </div>';


    ?>

    <style>

    form#gycForm-total{

        max-width: 720px;

        margin: 30px auto;

    }

    .grid-notfor-supp{

        display: grid;

        grid-template-columns: repeat(3, 1fr);

        gap: 12px;

    }

    .grid-notfor-supp select{

        padding: 8px;

        width: 100%;

    }

    .error{

        color: #d00;

        margin-top: 10px;

        display: none;

    }

    </style>


    <script>

    (() => {


        const form     = document.getElementById('gycForm-total');

        const gianHang = document.getElementById('gian_hang');

        const tabCha   = document.getElementById('tab_cha');

        const tabCon   = document.getElementById('tab_con');

        const errorMsg = document.getElementById('errorMsg');


        const chaOpts = [...tabCha.querySelectorAll('option')];

        const conOpts = [...tabCon.querySelectorAll('option')];


        // ===== GIAN HÀNG → TAB CHA =====

        gianHang.addEventListener('change', () => {


            tabCha.innerHTML = '<option value="">-- Tab cha --</option>';

            tabCon.innerHTML = '<option value="">-- Tab con --</option>';

            tabCon.disabled = true;


            if (!gianHang.value) {

                tabCha.disabled = true;

                return;

            }


            chaOpts.forEach(opt => {

                if (opt.dataset.parent == gianHang.value) {

                    tabCha.appendChild(opt.cloneNode(true));

                }

            });


            tabCha.disabled = false;

        });


        // ===== TAB CHA → TAB CON =====

        tabCha.addEventListener('change', () => {


            tabCon.innerHTML = '<option value="">-- Tab con --</option>';


            if (!tabCha.value) {

                tabCon.disabled = true;

                return;

            }


            conOpts.forEach(opt => {

                if (opt.dataset.parent == tabCha.value) {

                    tabCon.appendChild(opt.cloneNode(true));

                }

            });


            tabCon.disabled = false;

        });


        // ===== VALIDATE =====

        form.addEventListener('submit', e => {

            if (!gianHang.value || !tabCha.value || !tabCon.value) {

                e.preventDefault();

                errorMsg.style.display = 'block';

            } else {

                errorMsg.style.display = 'none';

            }

        });


    })();

    </script>

    <?php

Thứ Hai, 9 tháng 2, 2026

Fix Lỗi JS ở các trang web



**** Lỗi:

div.querySelectorAll("*,:x")


 **** Fix JS:
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<script>
      $('div *').addClass('example');
</script>


 **** Bỏ stick bên tay phải:
Trong DevTools (F12) → cột phải:

  • ❌ Bỏ tick Pause on caught exceptions

  • (giữ nguyên Pause on uncaught cũng được)


Thứ Ba, 20 tháng 1, 2026

Google Translate - ngôn ngữ



/****JS ở Footer******/
 
<style type="text/css">

    .lang-switch {

        display: flex;

        gap: 8px;

        align-items: center;

    }

    .lang-switch img {

        /*width: 22px;

        height: 15px;*/

        cursor: pointer;

        border-radius: 2px;

        transition: 0.2s;

    }

    .lang-switch img:hover {

        opacity: 0.7;

    }

    /* Ẩn Google Translate bar */

    .goog-te-banner-frame,

    .goog-logo-link,

    .goog-te-gadget {

        display: none !important;

    }

    /* Ẩn toàn bộ Google Translate */

    .skiptranslate {

        display: none !important;

    }

    /* Fix lỗi bị đẩy trang xuống */

    body {

        top: 0 !important;

    }

    .khuyenmai-hots > ul > li > a {

        white-space: nowrap;

    }

    .home-menu > ul > li {

        display: flex;

        align-items: center;

    }

    font {

        display: inline !important;

        line-height: inherit !important;

    }

</style>


<script type="text/javascript">

function googleTranslateElementInit() {

    new google.translate.TranslateElement({

        pageLanguage: 'vi',

        autoDisplay: false

    }, 'google_translate_element');

}


function changeLang(lang) {

    let select = document.querySelector("select.goog-te-combo");

    if (!select) return;


    select.value = lang;

    select.dispatchEvent(new Event("change"));

}

</script>

<script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>


/****body******/

googletranslate__languages();

function googletranslate__languages(){


    global $site_live,$ThemeSel;


    echo'

    <div class="lang-switch language">

        <a href="javascript:void(0)" onclick="changeLang(\'zh-TW\')">

            <img src="/themes/'.$ThemeSel.'/images/china.png" alt="CN">

        </a>

        <a href="javascript:void(0)" onclick="changeLang(\'en\')">

            <img src="/themes/'.$ThemeSel.'/images/en.png" alt="EN">

        </a>

        <a href="javascript:void(0)" onclick="changeLang(\'ja\')">

            <img src="/themes/'.$ThemeSel.'/images/jp.png" alt="JP">

        </a>

        <a href="javascript:void(0)" onclick="changeLang(\'ko\')">

            <img src="themes/'.$ThemeSel.'/images/kr.png" alt="KR">

        </a>

    </div>';


    echo'<div id="google_translate_element"></div>';

}

Thứ Sáu, 16 tháng 1, 2026

Nhập Input Text Js

 Nhập Input Text trên thì Input Text dưới hiện y chang

**** Cách 1:

<input name="title" id="title" type="text" class="form-control" value="Máy pha cà phê Solis Barista Perfetta Plus">

<input name="pid_link" id="pid_link"  type="text" class="form-control" value="May-pha-ca-phe-Solis-Barista-Perfetta-Plus">

<script>

$(document).ready(function ($) {

    function slugify(text) {

        return text

            .toLowerCase()

            .normalize('NFD')

            .replace(/[\u0300-\u036f]/g, '')

            .replace(/[^a-z0-9\s-]/g, '')

            .trim()

            .replace(/\s+/g, '-')

            .replace(/-+/g, '-');

    }

    function autoSlug(titleSelector, slugSelector) {

        $(document).on('input blur change', titleSelector, function () {

            $(slugSelector).val(slugify($(this).val()));

        });

    }

    // dùng

    autoSlug('#title', '#pid_link');

});

</script>

#---------------------------------#

Cách 2:

<input class="form-control js-slug-title" data-slug="#pid_link">

<input id="pid_link" class="form-control">

<script>

$(document).ready(function ($) {

    function slugify(text) {

        return text

            .toLowerCase()

            .normalize('NFD')

            .replace(/[\u0300-\u036f]/g, '')

            .replace(/[^a-z0-9\s-]/g, '')

            .trim()

            .replace(/\s+/g, '-')

            .replace(/-+/g, '-');

    }

    $(document).on('input', '.js-slug-title', function () {

        const target = $(this).data('slug');

        $(target).val(slugify($(this).val()));

    });

});

</script>

Thứ Năm, 15 tháng 1, 2026

Thay cho input fiile thông thường

==== html

<input type="file" id="avatar-file" name="savepic" hidden multiple style="display: none;">

  <button type="button" id="choose-button-img" class="btn btn-primary">
        <i class="fa fa-picture-o"></i>  Chọn hình ảnh liên quan
  </button>

 <script>
    document.getElementById('choose-button-img').onclick = function () {

        document.getElementById('avatar-file').click();
    };
</script>

==== Save Pic

function uploads__savepic(){

    if (empty($_FILES['savepic']['name'])) {

        return '';

    }

    // $upload_dir = "uploads/News/pic";

    $upload_dir = $_SERVER['DOCUMENT_ROOT'] . "/uploads/News/pic/";

    if (!is_dir($upload_dir)) {

        mkdir($upload_dir, 0777, true);

    }

    $name     = $_FILES['savepic']['name'];

    $tmp_name = $_FILES['savepic']['tmp_name'];

    $error    = $_FILES['savepic']['error'];

    if ($error != 0) {
        return '';
    }

    $info = pathinfo($name);

    $filename = preg_replace('/[^a-zA-Z0-9-_]/', '-', $info['filename']);

    $filename = trim($filename, '-');

    $ext = strtolower($info['extension']);

    // chỉ cho phép ảnh

    $allow = array('jpg','jpeg','png','gif','webp');

    if (!in_array($ext, $allow)) {

        return '';

    }

    $new_name = $filename.'.'.$ext;

    $path = $upload_dir.$new_name;


    // nếu trùng tên → thêm (1)(2)...

    $i = 1;

    while (file_exists($path)) {

        $new_name = $filename.'('.$i.').'.$ext;

        $path = $upload_dir.$new_name;

        $i++;

    }

    if (move_uploaded_file($tmp_name, $path)) {

        return $new_name; // ✅ RETURN TÊN FILE

    }

    return '';

}

Thứ Tư, 14 tháng 1, 2026

Web bị tấn công có đuôi _4727f99

 


**** Ngừa bị Hacker *****************

1️⃣ Đổi toàn bộ mật khẩu

cPanel / Hosting

FTP

MySQL

Admin NukeViet

Email quản trị

✔️ Mật khẩu ≥ 12 ký tự, có:

A–Z a–z 0–9 !@#$%^

2️⃣ Xóa hoàn toàn file dư thừa

XÓA NGAY nếu tồn tại:

info.php

test.php

upload.php (ngoài module)

shell.php

1.php

cache.php (ngoài core)

✔️ Thư mục chỉ được phép:

/admin

/modules

/themes

/uploads

/vendor


3️⃣ Kiểm tra backdoor bằng tay (quan trọng)

Tìm toàn bộ source với các chuỗi:

base64_decode(

gzinflate(

gzuncompress(

eval(

curl_init(

file_get_contents("http

👉 File nào có từ 2 chuỗi trở lên → xóa

🔴 II. BẢO MẬT FILE & CHMOD (NUKEVIET CHUẨN)


4️⃣ Phân quyền thư mục đúng

Folder: 755

File:   644

config.php: 444 (hoặc 400)

❌ KHÔNG BAO GIỜ:

chmod 777


5️⃣ Khóa thực thi PHP trong uploads

Tạo file:

/uploads/.htaccess

Nội dung:

<FilesMatch "\.(php|phtml|php3|php4|php5|php7|phar)$">

    Deny from all

</FilesMatch>

✔️ Ngăn 99% webshell

🔴 III. HARDEN NukeViet 5.3


6️⃣ Đổi URL admin

Trong config:

define('NV_ADMIN_DIR', 'admin_abc123');

✔️ Tránh bot quét /admin


7️⃣ Bật CAPTCHA & 2FA

Admin → Cấu hình:

CAPTCHA đăng nhập

Giới hạn login sai

Session timeout ngắn


8️⃣ Xóa module & theme không dùng

Không dùng → xóa hẳn

Không để:

/modules/demo

/themes/default_old

🔴 IV. KHÓA LỖ UPLOAD (NGUYÊN NHÂN PHỔ BIẾN NHẤT)


9️⃣ Kiểm tra code upload ảnh

Chỉ cho phép:

$allow = ['jpg','jpeg','png','gif','webp'];

❌ Cấm:

.php.jpg

image.php

shell.phtml

✔️ Check MIME + extension


🔟 Rename file upload

Không dùng tên gốc:

$filename = md5(time().rand()).'.jpg';

🔴 V. CHỐNG GỌI SERVER NGOÀI (BACKDOOR)

1️⃣1️⃣ Tắt function nguy hiểm (php.ini nếu có)

disable_functions = exec,shell_exec,passthru,system,proc_open,popen

(Nếu shared hosting không cho → bỏ qua)


1️⃣2️⃣ Block domain độc trong .htaccess

RewriteCond %{HTTP_HOST} rakuten.* [NC]

RewriteRule .* - [F]


🔴 VI. GIÁM SÁT & PHÒNG NGỪA

1️⃣3️⃣ Theo dõi file thay đổi

Hàng tuần:

So file mới

So modified time

✔️ File PHP mới trong /uploads = nguy hiểm


1️⃣4️⃣ Backup định kỳ (BẮT BUỘC)

1 bản/ngày

Giữ ít nhất 7 ngày

Backup OFF HOSTING (Google Drive)


1️⃣5️⃣ Log truy cập

Theo dõi:

POST bất thường

Upload nhiều file

User-Agent lạ

🔴 VII. DẤU HIỆU WEB BỊ HACK LẦN NỮA


❌ Google redirect

❌ File tự đổi tên

❌ Xuất hiện .click, .xyz

❌ .htaccess tự thay

❌ Website load chậm bất thường


➡️ XỬ LÝ NGAY – KHÔNG ĐỂ QUA NGÀY

🟢 GỢI Ý NÂNG CAO (NÊN LÀM)

Dùng Cloudflare (Free)

Bật WAF

Chặn IP quốc gia không dùng

Giới hạn admin IP