mysql设计,统计脚本执行的间隔时间。
我有一个RSS程序,想统计一下:是其他网站的服务器订阅了我的RSS,还是普通客户通过浏览器打开执行。
现在的思路是:统计每个IP地址的访问频率用以区分。如果是其他网站的服务器订阅了我的RSS,那么一定是用自动程序定时执行,每次执行间隔时间是一个定数,比如每60分钟,每90分钟访问一次。
$ip=$_SERVER['REMOTE_ADDR'];
这样的情况,怎样设计mysql数据库呢? 本次访问时间-上次访问时间;上次访问时间-前次访问时间;再前次访问时间-前次访问时间(应该还须考虑一个每次脚本打开完成时间的误差可能正负几秒)... 这样的情况统计5次,大概可以确定该IP是自动程序,下次无需再统计。
回复讨论(解决方案)
两个字段:ip, time(unix时间戳)
判定条件:对于同一ip (max(time) - min(time)) / count(*) = avg(time) - min(time)
算法依据:等差数列的性质
其实你还可以判断User-Agent信息。
两个字段:ip, time(unix时间戳)
判定条件:对于同一ip (max(time) - min(time)) / count(*) = avg(time) - min(time)
算法依据:等差数列的性质
2个自段,可行吗?能不能给一段代码吗?
我水平不高,初想要5个字段,“ip;上次访问时间(本次访问时间-上次访问时间,用以计算);2次访问时间差;平均访问时间差;is_sever(默认值为0,是服务器的话升级为1,然后下次同样IP访问,就不需要再计算了)”
确定是server的,应该放在另一个表(例serverlist)中记录。
首先,版主讲的是每一次有访问且未确定是否服务器,都将ip与访问时间写入一个表(例accesslog)。每次写入后,判断是否服务器访问。(通常要几次才可以确定)
如果是,在serverlist插入一条记录,并把accesslog对应ip的记录删除。
当这个服务器再访问时,先判断serverlist有没有这个ip,如果有,则不写入accesslog。
另外,可以用user-agent来判断是否server访问。
什么是服务器访问呢?
什么服务器会订阅你的 rss ?
或是说什么网站会把你的 rss 存储于自己的数据库中?
另外,可以用user-agent来判断是否server访问。
什么是服务器访问呢?
什么服务器会订阅你的 rss ?
或是说什么网站会把你的 rss 存储于自己的数据库中?
什么是服务器访问呢? 说白了就是别人用自动程序抓取我的RSS,而不是浏览器或者RSS阅读器打开。
什么服务器会订阅你的 rss ? 或是说什么网站会把你的 rss 存储于自己的数据库中?
后两个问题我不再乎,我只想统计有多少不同IP的自动程序来抓取我网站的RSS信息。user-agent可以通过CURL之类的模仿,但是自动程序的唯一通性就是??99%都会通过cron程序,定时访问抓取,所以我想做个程序,通过分析不同IP的每次间隔访问时间,来分辨是否自动程序?当然最好不要用log,用数据库的话方便管理以及数据分析。
谢谢。
怎么说?到底什么用什么方法?2个字段可以吗?
所以说 2 个字段就可以满足记流水账的需要了
至于分析的结果是否也保存在同一个表中,那是由你决定的。如果是,当然还需要增加些字段
所以说 2 个字段就可以满足记流水账的需要了
至于分析的结果是否也保存在同一个表中,那是由你决定的。如果是,当然还需要增加些字段
当然不是流水账?问题是认真的。思路也说明白了,只是自己写代码信心不大,而且数据库怎么样设计最合理?大虾给个建议。
登记访问信息,当然是流水账
只需 insert 即可,分析计算一般也只需一条 update
弄的好的话,还可以用 view
如果你不把登记当做流水账则需先 select 定位,然后 update 修改
最后再分析计算
登记访问信息,当然是流水账
只需 insert 即可,分析计算一般也只需一条 update
弄的好的话,还可以用 view
如果你不把登记当做流水账则需先 select 定位,然后 update 修改
最后再分析计算
术语太专业了,能不能分享一下数据库结构,已经相关的insert,update和select的代码?谢谢.
结贴了。想的差不多了。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Cutting is a video editing tool with comprehensive editing functions, support for variable speed, various filters and beauty effects, and rich music library resources. In this software, you can edit videos directly or create editing scripts, but how to do it? In this tutorial, the editor will introduce the method of editing and making scripts. Production method: 1. Click to open the editing software on your computer, then find the "Creation Script" option and click to open. 2. In the creation script page, enter the "script title", and then enter a brief introduction to the shooting content in the outline. 3. How can I see the "Storyboard Description" option in the outline?

How to execute .sh file in Linux system? In Linux systems, a .sh file is a file called a Shell script, which is used to execute a series of commands. Executing .sh files is a very common operation. This article will introduce how to execute .sh files in Linux systems and provide specific code examples. Method 1: Use an absolute path to execute a .sh file. To execute a .sh file in a Linux system, you can use an absolute path to specify the location of the file. The following are the specific steps: Open the terminal

According to news on March 4, Kubi Rubik's Cube will launch the "Xiaoku Tablet 2Lite" tablet computer on March 5, with an initial price of 649 yuan. It is reported that the new tablet is equipped with Unisoc’s T606 processor, which uses a 12nm process and consists of two 1.6GHz ArmCortex-A75 CPUs and six ArmCortex-A55 processors. The screen uses a 10.95-inch IPS eye-protection screen with a resolution of 1280x800 and a brightness as high as 350 nits. In terms of imaging, Xiaoku Tablet 2Lite has a 13-megapixel main camera on the rear and a 5-megapixel selfie lens on the front. It also supports 4G Internet access/calls, Bluetooth 5.0, and Wi-Fi5. In addition, the official claimed that this tablet&l

According to news on April 26, ZTE’s 5G portable Wi-Fi U50S is now officially on sale, starting at 899 yuan. In terms of appearance design, ZTE U50S Portable Wi-Fi is simple and stylish, easy to hold and pack. Its size is 159/73/18mm and is easy to carry, allowing you to enjoy 5G high-speed network anytime and anywhere, achieving an unimpeded mobile office and entertainment experience. ZTE 5G portable Wi-Fi U50S supports the advanced Wi-Fi 6 protocol with a peak rate of up to 1800Mbps. It relies on the Snapdragon X55 high-performance 5G platform to provide users with an extremely fast network experience. Not only does it support the 5G dual-mode SA+NSA network environment and Sub-6GHz frequency band, the measured network speed can even reach an astonishing 500Mbps, which is easily satisfactory.

According to news on April 17, HMD teamed up with the well-known beer brand Heineken and the creative company Bodega to launch a unique flip phone - The Boring Phone. This phone is not only full of innovation in design, but also returns to nature in terms of functionality, aiming to lead people back to real interpersonal interactions and enjoy the pure time of drinking with friends. Boring mobile phone adopts a unique transparent flip design, showing a simple yet elegant aesthetic. It is equipped with a 2.8-inch QVGA display inside and a 1.77-inch display outside, providing users with a basic visual interaction experience. In terms of photography, although it is only equipped with a 30-megapixel camera, it is enough to handle simple daily tasks.

According to news on July 12, the Honor Magic V3 series was officially released today, equipped with the new Honor Vision Soothing Oasis eye protection screen. While the screen itself has high specifications and high quality, it also pioneered the introduction of AI active eye protection technology. It is reported that the traditional way to alleviate myopia is "myopia glasses". The power of myopia glasses is evenly distributed to ensure that the central area of sight is imaged on the retina, but the peripheral area is imaged behind the retina. The retina senses that the image is behind, promoting the eye axis direction. grow later, thereby deepening the degree. At present, one of the main ways to alleviate the development of myopia is the "defocus lens". The central area has a normal power, and the peripheral area is adjusted through optical design partitions, so that the image in the peripheral area falls in front of the retina.

According to news on April 3, Taipower’s upcoming M50 Mini tablet computer is a device with rich functions and powerful performance. This new 8-inch small tablet is equipped with an 8.7-inch IPS screen, providing users with an excellent visual experience. Its metal body design is not only beautiful but also enhances the durability of the device. In terms of performance, the M50Mini is equipped with the Unisoc T606 eight-core processor, which has two A75 cores and six A55 cores, ensuring a smooth and efficient running experience. At the same time, the tablet is also equipped with a 6GB+128GB storage solution and supports 8GB memory expansion, which meets users’ needs for storage and multi-tasking. In terms of battery life, M50Mini is equipped with a 5000mAh battery and supports Ty

We've designed this Windows PowerShell scripting tutorial for beginners, whether you're a tech enthusiast or a professional looking to improve your scripting skills. If you have no prior knowledge of PowerShell scripting, this article will start with the basics and be tailored for you. We'll help you master the installation steps for a PowerShell environment and walk you through the main concepts and features of PowerShell scripts. If you're ready to learn more about PowerShell scripting, let's embark on this exciting learning journey together! What is WindowsPowerShell? PowerShell is a hybrid command system developed by Microsoft
