Home > Backend Development > PHP Tutorial > How to use PHP to limit the number of pages viewed per day per IP_PHP Tutorial

How to use PHP to limit the number of pages viewed per day per IP_PHP Tutorial

WBOY
Release: 2016-07-21 14:53:42
Original
1039 people have browsed it

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

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/371353.htmlTechArticleImplementation idea: First, create a table, such as the following CREATE TABLE ip_log ( ip_log_ip VARCHAR(40), ip_log_date DATE , ip_log_visits TINYINT(1), ip_log_page varchar(255), PRIMARY K...
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