1: In the configuration file, first define the database connection configuration, COOKIE Path, domain, SESSION expiration time, default character encoding default time zone, and other common data,
2: add an IN_ECS constant to the initialization file public function library basic class file to determine whether to allow direct access
3: escape the data in the user input form. First, check whether the get_magic_quotes_gpc function is enabled in the php configuration file. If the get_magic_quotes_gpc function is not enabled, run the function of the custom escape string. Purpose: 1: SQL injection attacks can be easily solved. 2: Prevent HTML code input by users. When the user extracts the HTML code from the database, the original style of the page may change in the message book)
4: Use a directory to store the logo printing books of the flash brand, zip packages, cotton advertisement pictures, and other materials;
5: Define a class that specifically outputs error information as a full-site error, warning, and prompt object, so that the prompted error information is separated from the program;
6. Extract all public parameters from the database and write them into a cache file, which is changed to static output;
7: judge whether the search engine spider accesses normal users during each access, so as not to generate too much session data and write it into the database, so that the database suddenly increases, resulting in website crash, if a normal user initializes the session class and writes it to the session data table in the database
8: To enhance session Security, use a random function to generate session_id and carry a unique id based on the number of microseconds of the current time. The client IP address is used for md5 encryption, $ _ SERVER ['HTTP _ USER_AGENT ']) is used as the key, and a 32-Bit String is generated through the crc32 function as the basis to enhance session Security. If the user's IP address or client changes, this session will expire and a new session will be created for the client again.
9: ajax is used in the shopping process to increase the concealment of important data
10: smarty generates cache files and cannot be accessed directly. If each cached file contains a single line of direct access, it will exit. A json code string is followed to record the modification time of the template file, unlike the expiration time of the file itself and the original smarty, ECSHOP modifies the smarty). Once the template is changed, the cache file will be modified again, or after comparison with the current time, if the expiration time is reached, the cached file will be modified again after expiration.
11. Divide template files into static and dynamic parts for separate storage;
12: to protect the security of the database, when the initialization of the Database Class is complete, the database's host name or ip address, user name, password, and variables are cleared.
13: A js function library is found in the js folder to convert strings into json code.
This article is from the Freax blog, please be sure to keep this source http://freax.blog.51cto.com/6614733/1297273