Hongmu Notes
Home Summary of pitfalls

Summary of pitfalls

A summary of common mistakes encountered when building websites... This list isn't exhaustive; it merely records the issues I faced during my own development projects.

Nginx blocks sensitive directories for security protection

Nginx blocks sensitive directories for security protection Summary of pitfalls

Cause: A few days ago, I added a backend management function to my blog, and added a new SQLite database directory Mdata and cache directory Mcache. After the function ran smoothly, an idea suddenly popped up: What would happen if I directly accessed https://domain name/Mdata/content.db? After trying it, the browser started downloading a file - the database file was completely exposed. It contains all the articles…
👁 16
Empire cms8.0 search list page supports dynamic php code display

Empire cms8.0 search list page supports dynamic php code display Program Notes Empire cms PHP Summary of pitfalls

Empire cms updated to 8.0. During daily use, I discovered that this search list page does not support dynamic php code display, so I modified the code and put it here. <?php require("../../class/connect.php"); require("../../data/dbcache/class.php");…
👁 85
Kakaka, one bug can be fixed in one day! <b>Fatal error</b>: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in

Kakaka, one bug can be fixed in one day! <b>Fatal error</b>: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined in Summary of pitfalls

Regarding the problem of $stmt->execute($categoryIds); passing parameters. I'm really convinced. Just such a question has troubled me all afternoon! It wasn't until I went to look through the documents at night that I discovered that it was a problem with this thing. PDOException: SQLSTATE[HY093] error, the core reason is that the parameter placeholder in the SQL statement is different from the execu...
👁 75
In the Linux terminal, view the sizes of all files and subdirectories in the current directory and display them sorted by size.

In the Linux terminal, view the sizes of all files and subdirectories in the current directory and display them sorted by size. Summary of pitfalls

In the Linux terminal, view the size of all files and subdirectories in the current directory and display them sorted by size. Commonly used commands are: 1. Display the size of all files/directories (including hidden files) and sort du -sh .[!.]* * 2>/dev/null | sort -hrdu -sh: Count the size of each item (-s summary, -h human readable).[!.]* …
👁 94
How to make WordPress fly? I used SQLite to defeat Redis

How to make WordPress fly? I used SQLite to defeat Redis Program Notes Summary of pitfalls wordpress

My website runs on WordPress + Zibi theme. Zibi knows everything about this thing - login, membership, download permissions, QQ login, reply visibility...it is packed with functions, and the database needs to be checked dozens of times every time it is refreshed. So I wanted to simply transform it. The code has been put in place. https://github.com/1810216796/wordpress-sqlite-cach…
👁 92
How to enable error reporting in php?

How to enable error reporting in php? Summary of pitfalls

Simple and efficient method. Add the code directly. <?php error_reporting(E_ALL); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); ?> Just add the following code at the very top of the erroring PHP file, for the current script only...
👁 84
A simple single page of the website can be used to introduce yourself, or it can be a single page for pure display.

A simple single page of the website can be used to introduce yourself, or it can be a single page for pure display. Language Notes CSS Summary of pitfalls

Record this single page. That is, the code for a simple page implementation is as follows: <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8" /> <meta name="viewport" content…
👁 64
Highly efficient web page caching page code

Highly efficient web page caching page code Summary of pitfalls

Previously studied, high-performance PHP cache system design: intelligent cleaning and counting management. But I found that this can only cache individual html, not some data that I want to cache. At the same time, in order to solve the limitations of inode. So I tried to put the cache files into the db database to achieve efficient storage. 1. System Overview Core Class: ApiCache (located in ApiCache.php) Cache Mode: Normal…
👁 161
High-performance PHP cache system design: intelligent cleaning and counting management

High-performance PHP cache system design: intelligent cleaning and counting management Summary of pitfalls

In web projects, page caching is a common method to improve performance. I originally used a simple file caching plug-in [Empire cms PHP cache web page code to speed up access], which caches all pages equally. However, in actual business, some pages (such as the home page) receive a large number of visits every day, while other pages (such as unpopular articles) may only receive a few visits occasionally. This “one size fits all” caching strategy results in a large number of low-value caches…
👁 81
Python batch cuts the left and right sides of pictures

Python batch cuts the left and right sides of pictures Language Notes Summary of pitfalls python

python code to automatically detect the distance between both sides of the image: import cv2 import numpy as np image_path = r"C:\Users\18102\Downloads\ok\0001.png" # Please change to the actual screenshot path img = cv2.imread(image_path) if …
👁 61
1 2 3 14