Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set the limit of browsing per ip several times per day by php

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces php how to set the limit of browsing several times a day for each ip, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.

Php to achieve several times a day for each ip browsing method: 1, through the "CREATE TABLE ip_log ()" to create a table; 2, set when the user visits to record ip information, the initial value of browsing times is 1 to 3, when the number of browsing pages is equal to the set value, users are not allowed to access.

This article operating environment: Windows7 system, PHP7.1 version, Dell G3 computer

The implementation idea of using php to limit the number of pages viewed per ip per day

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, and the initial value of the number of browsing is 1

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

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

Thank you for reading this article carefully. I hope the article "how to set the limit for browsing several times per ip per day" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report