How to recognize bots with php?

后端 未结 7 927
囚心锁ツ
囚心锁ツ 2020-12-24 14:33

I am building stats for my users and dont wish the visits from bots to be counted.

Now I have a basic php with mysql increasing 1 each time the page is called.

7条回答
  •  不知归路
    2020-12-24 15:18

    You should filter by user-agent strings. You can find a list of about 300 common user-agents given by bots here: http://www.robotstxt.org/db.html Running through that list and ignoring bot user-agents before you run your SQL statement should solve your problem for all practical purposes.

    If you don't want the search engines to even reach the page, use a basic robots.txt file to block them.

提交回复
热议问题