Hiển thị các bài đăng có nhãn error. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn error. Hiển thị tất cả bài đăng

Thứ Ba, 27 tháng 10, 2026

Check Errors

 if (!function_exists('vb_debug')) {

    function vb_debug($msg){

        // Đường dẫn tới public_html/php-error.log

        $file = $_SERVER['DOCUMENT_ROOT'].'/php-error.log';

        @error_log(date('Y-m-d H:i:s').' '.$msg."\n", 3, $file);

    }

}

function vb_superpage_mode($userid, $userlevel){

    global $db;

    $userid = (int)$userid;

    $today  = date('Y-m-d');

    $tag    = 'SPMODE uid='.$userid.' level='.$userlevel.' today='.$today.' => ';


    if (!in_array((int)$userlevel, array(3, 4, 5))) {

        vb_debug($tag.'STOP: level khong thuoc 3,4,5');

        return 0;

    }

    if ($userid <= 0) {

        vb_debug($tag.'STOP: userid <= 0');

        return 0;

    }

    $result = $db->sql_query("SELECT superpage, date_active, date_expired

        FROM superpage_config

        WHERE shopid = ".$userid."

        ORDER BY id DESC");

    if (!$result) {

        vb_debug($tag.'STOP: SQL error');

        return 0;

    }


    $found = 0;

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

        $found++;

        $begin = substr(trim((string)$row['date_active']), 0, 10);

        $end   = substr(trim((string)$row['date_expired']), 0, 10);

        vb_debug($tag.'ROW superpage='.$row['superpage'].' begin='.$begin.' end='.$end);


        if (!desk_has_date($end))                     continue;

        if ($end < $today)                            continue;

        if (desk_has_date($begin) && $begin > $today) continue;


        $mode = (int)$row['superpage'];

        vb_debug($tag.'OK mode='.$mode);

        return ($mode === 1 || $mode === 2) ? $mode : 0;

    }


    vb_debug($tag.'STOP: '.($found ? 'co dong nhung het han/chua toi ngay' : 'KHONG co dong nao voi shopid nay'));

    return 0;

}

Thứ Hai, 14 tháng 9, 2026

Lỗi trang Mobi của website


Hack in COOKIE-c_ref_5027813 = https://www.google.com/

- kiểm tra lại file security (thay đổi code cũ bằng đoạn code này)

if($security_cookies==1) {    

    foreach ($_COOKIE as $var_name => $var_value) {

        // Bỏ qua kiểm tra đối với các cookie c_ref từ trình duyệt/máy tìm kiếm

        if (strpos($var_name, 'c_ref') === 0) {

            continue;

        }

        if (preg_match("/<.*?(script|object|iframe|applet|meta|style|form|img|onmouseover|body).*?>/", $var_value)) die ($htmlerr);

        if (preg_match("/^(http\:\/\/|ftp\:\/\/|\/\/|https:\/\/|php:\/\/|\/\/)/i", $var_value)) die ("Hack in COOKIE 1111 - ".$var_name." = ". $var_value);

        $security_string = "/UNION|OUTFILE|SELECT|ALTER|INSERT|DROP|FROM|WHERE|UPDATE|".$prefix."_authors|".$prefix."_users|UpdateAuthor|AddAuthor|mod_authors|modifyadmin|deladmin|deladmin2/i";

        $security_decode = base64_decode($var_value);

        if (preg_match($security_string, $security_decode)) die ("Hack base64 in COOKIE - ".$var_name." = ". $var_value."");

        if (preg_match($security_string, $var_value)) die ("Hack in COOKIE 2222 - ".$var_name." = ". $var_value."");

        $security_slash = preg_replace("/\/\*.*?\*\//", "", $var_value);

        if (preg_match($security_string, $security_slash)) die ("Hack in COOKIE 3333 - ".$var_name." = ". $var_value."");

    }

}

Thứ Tư, 27 tháng 5, 2026

htmlspecialchars show hết lỗi dấu nháy - bird" s

$title_en="bird's nest products";

<input class="form-control" id="txt_name_en" name="txt_name_en" placeholder="Tên sản phẩm - Tiếng anh (*)" value="bird" s="" nest="" products'="" maxlength="80" required="">

và sử dụng hàm htmlspecialchars là OK.

htmlspecialchars($title_en, ENT_QUOTES)

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



Thứ Hai, 19 tháng 5, 2025

Lỗi Host Cơ Bản



 1.##┌────────────────────────────────────────────────┐     

    ## Note: Không vào được 2222

    - Nếu mạng khác vào được thì bị DOD

    - Trường hợp vào không được:

        + Vào: whatismyip.com

        + Xem: My Public IPv4: ?

        + Vidu: My Public IPv4: 116.110.42.114

        + Báo quản trị host

##└────────────────────────────────────────────────┘



Minh họa 2

2.##┌────────────────────────────────────────────────┐     

    ## Note: Trang web bị lag không load được trang

    - Vào: Service Monitor:

        + exim : Email

        + httpd : Website

        + mysqld: database

    - Vượt qua mấy GB thì restart lại

##└────────────────────────────────────────────────┘


3.##┌────────────────────────────────────────────────┐     

  ## Note: Đổi pass mà không gửi qua email được

    - Vào: Mail Queue Administration:

    - E-Mail Body Chunk:

        + Xem pass ở đó

##└────────────────────────────────────────────────┘


4.##┌────────────────────────────────────────────────┐     

  ## Note: không vào được trang web hoặc báo lỗi 503

    - Bị lỗi SSl:

    - Vào Domain ---&&&--- Login as NameDomain:

        + Vào: SSL Certificates

        + Vào: Use the server's shared signed certificate.

            . checked vào ô bên trái

            . Bên phải chọn: Free & automatic certificate from Let's Encrypt

            . Bỏ checked: Wildcard

            . Bỏ đoạn code này: admintam-iV$1jA65hWU@l

##└────────────────────────────────────────────────┘

Thứ Hai, 6 tháng 1, 2025

SSL Domain

**** Error: 

Forbidden

You don't have permission to access this resource.

http:// && https:// ( chạy domain , Nếu báo lỗi như trên )


**** Cách khắc phục như hình phía dưới:





Thứ Sáu, 3 tháng 1, 2025

Đầy host, Lỗi đăng nhập Control Panel không được

 Lỗi host vào 2222 không được



Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/home/jkm/tmp) in Unknown on line 0


Thứ Sáu, 27 tháng 12, 2024

ERROR sql_mode, Select hai cấp javascript changeDynaList


 **** Template

<form name="adminForm">

<script>

function changeDynaList( listname, source, key, orig_key, orig_val ) {

var list = eval( 'document.adminForm.' + listname );

// empty the list

for (i in list.options.length) {

list.options[i] = null;

}

i = 0;

for (x in source) {

if (source[x][0] == key) {

opt = new Option();

opt.value = source[x][1];

opt.text = source[x][2];


if ((orig_key == key && orig_val == opt.value) || i == 0) {

opt.selected = true;

}

list.options[i++] = opt;

}

}

list.length = i;

}

var sinhvienlop = new Array;

// sinhvienlop[$key] = new Array( 'mid','catid','title');

sinhvienlop[0] = new Array( '0','0','Chon SV' );

sinhvienlop[1] = new Array( '1','10','SV1' );

sinhvienlop[2] = new Array( '1','11','SV1-1' );

sinhvienlop[3] = new Array( '2','2','SV2' );

sinhvienlop[4] = new Array( '3','3','SV3' );

</script>


<select class="form-control admin-width-200" style="float:left;margin-right:10px;" name="lop" id="lop" size="1" onchange="changeDynaList( 'sinhvien', sinhvienlop, document.adminForm.lop.options[document.adminForm.lop.selectedIndex].value, 0, 0);">

    <option value="0" selected="selected">- Chọn lớp -</option>

    <option value="1" >Lop 1</option>

    <option value="2" >Lop 2</option>

    <option value="3" >Lop 3</option>

</select>

<select class="form-control admin-width-200" name="sinhvien" id="sinhvien" size="1">

        <option value="0" >Chon SV</option>

</select>

</form>


 **** Code đang sử dụng

<form enctype="multipart/form-data" action="link đến trang" method="post" name="adminForm">

<script language="javascript" type="text/javascript">

var sectioncategories = new Array;

sectioncategories[0] = new Array( '-1','-1','Select Category' );

// sectioncategories[1] = new Array('0','0','Uncategorized' );

<?php

$sql="SELECT b.mid as mid, b.custom_title  as title FROM modules b ";

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

$i=2;

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

      $midcha = $row['mid'];

    echo "sectioncategories[$i] = new Array('$midcha','0','Chủ đề chính','0') \n\n";

    $i++;

    $sqls="SELECT  a.*, b.title FROM stories_cat a,stories_cat_lang b  where a.catid=b.catid 

            and b.lang_id='$langid' and  a.mid ='$midcha' order by a.parentid,a.weight";

    $results = $db->sql_query($sqls);

    while ($rows = $db->sql_fetchrow($results)){   

$mid    = $rows['mid'];
$catid = $rows['catid'];
$title = $rows['title'];
$pid = $rows['parentid'];

echo "sectioncategories[$i] = new Array( '$mid','$catid','$title','$pid' ) \n\n";

$i++;

      }
} 

?>
</script>

<select class="form-control admin-width-200" style="float:left;margin-right:10px;" name="sectionid" id="sectionid" class="inputbox" size="1" onchange="changeDynaList('catid', sectioncategories, document.adminForm.sectionid.options[document.adminForm.sectionid.selectedIndex].value, 0, 0);">

<option value="-1" >- Modules -</option>

<!-- <option value="0"  selected="selected">Uncategorized</option> -->

<?php

$sql3="SELECT  DISTINCT b.mid as mid, b.custom_title as title FROM stories_cat a right JOIN modules b ON a.mid=b.mid WHERE b.active =1 and b.mid !=368 and b.mid !=369 order by a.weight asc";

$result3 = $db->sql_query($sql3);

while ($row3 = $db->sql_fetchrow($result3)) {

$mid3   = $row3["mid"];
$title3   = $row3["title"];

  echo'<option value="'.$mid3.'">'.$title3.'</option>';

}

?>

</select>


<select class="form-control admin-width-200" name="catid" id="catid" class="inputbox" size="1">

<option value="-1" >Select Category</option>

</select>

</form>


<script>

function changeDynaList( listname, source, key, orig_key, orig_val ) {

var list = eval( 'document.adminForm.' + listname );

// empty the list

for (i in list.options.length) {

list.options[i] = null;

}

i = 0;

for (x in source) {

if (source[x][0] == key)

{

opt = new Option();

if(source[x][3]==0)

{

opt.value = source[x][1];

opt.text = source[x][2];

}

else

{

y=source[x][3];

for(k in source)

{

if(source[k][1]==y)

{

z=source[k][2];

break;

}

}

opt.value = source[x][1];

opt.text = z+' > '+source[x][2];

}

if ((orig_key == key && orig_val == opt.value) || i == 0) {

opt.selected = true;

}

list.options[i++] = opt;

}

}

list.length = i;

}

</script>

Thứ Hai, 2 tháng 12, 2024

Thứ Sáu, 29 tháng 11, 2024

Thứ Năm, 31 tháng 10, 2024

Error File config_var

 

**** Kiểm tra

--- Tất cả các file trong config mà chưa tìm được lỗi.............

--- xem qua file config_var.php nó có lỗi dấu phẩy ',' hoặc "

--- incudes/data/config_var.php

Thứ Hai, 8 tháng 7, 2024

Lỗi bảng trong database và cách khắc phục

 #145 - Table '.\engine\phpbb3_posts' is marked as crashed and should be repaired

I ran this command in PhpMyAdmin to fix it:

REPAIR TABLE phpbb3_posts;

Thứ Sáu, 29 tháng 9, 2023

Lỗi vào trang website là download

 Khi nhập tên miền trang website nào đó và enter nó nhảy vào download.............. nên xem lại phần .htaccess

Thứ Sáu, 11 tháng 8, 2023

Lỗi gửi email - gmail


 **** Khắc Phục

Chúng tôi đã điều chỉnh SMTP_BLOCK = "0" và mở port 465 trong csf.conf để khắc phục lỗi. Quý khách vui lòng kiểm tra thử lạ

Thứ Năm, 6 tháng 7, 2023

Error insert File Admin Text đưa vào

## admin/setting/ tuỳ biến

# php5.2
$content.="\$".$key."=\"".$_POST[$key]."\";\n";

# php5.3
$content.="\$".$key."='".$_POST[$key]."';\n";

 

preg_replace Lỗi không hiện chữ trong php5.3

Function

function mod_rewrite($str){

   //return '';

    $str_convert=array(

       'á'=>'a',

       'à'=>'a',

       'ả'=>'a',

       'ã'=>'a',

       'ạ'=>'a',

}
$str = strtr($str, $str_convert);

Error:
$str= preg_match("/[^[:alnum:]+ \-]/i","",$str);

Code đúng: 
$str= preg_replace("/[^[:alnum:]+ \-]/i","",$str);

>> chữ nên dùng hàm preg_replace php5.3