Home > Backend Development > PHP Tutorial > How to use PHP to limit the number of pages browsed by each IP per day, IP browsing pages_PHP tutorial

How to use PHP to limit the number of pages browsed by each IP per day, IP browsing pages_PHP tutorial

WBOY
Release: 2016-07-13 10:06:04
Original
1030 people have browsed it

Implementation idea of ​​using php to limit the number of pages browsed by each IP per day, IP browsing page

Implementation idea: First, create a table, such as the following

Copy code The code is as follows:

CREATE TABLE ip_log
(

 ip_log_ip VARCHAR(40),
ip_log_date DATE,
ip_log_visits TINYINT(1),
ip_log_page varchar(255),
PRIMARY KEY(ip_log_page,ip_log_ip,ip_log_date),
);

Then, write code to record the IP information when the user visits. The initial value of the number of views is 1,

When the number of pages viewed is equal to the set value, the user is not allowed to access.

Finally, you can run a cron table at 00:00 every night to delete all data, such as using truncate

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/960720.htmlTechArticleUse PHP to limit the number of pages browsed by each IP per day. Implementation ideas for IP browsing pages: First, create A table, for example, the following copy code code is as follows: CREATE TABLE ip_l...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template