使用PHP应用程序跟踪用户带宽 [英] Track User Bandwidth With PHP Application

查看:137
本文介绍了使用PHP应用程序跟踪用户带宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PHP和CodeIgniter进行校园项目.
这只是我要完成的项目.
然后,我不得不限制用户(应用程序,而不是Linux用户)使用的带宽.
而且我不知道要实现这一目标.
我想知道是否有人知道逻辑或曾经从事过类似的工作.
我基本上需要的是如何跟踪该用户(系统用户,而不是Linux用户)的带宽?
我应该计算该用户的所有请求和响应吗?
如何计算特定用户系统的imagse和静态文件下载量?
任何提示都将不胜感激.

I'm working on campus project using PHP and CodeIgniter.
It's only a project for my assignment.
Then it comes that i have to limit bandwidth used by user (of app, not linux user).
And i have no idea to implement this.
I wonder if someone know the logic or ever work on the similar tasks.
What basically i need is, how to track that user (system user, not linux user) bandwidth?
Should i count every requests and responses for that user?
How to count for imagse and static files download for specific user system?
Any hints is greatly appreciated.

解冻
伊万

推荐答案

我想到的唯一方法(使用php)之一是解析Web服务器的access.log,并为每个客户端增加带宽.

One of the only ways I can think of (using php) is to parse the access.log of the webserver, and add up the bandwidth for each client.

下次加载页面且客户端达到设置的限制时,您可以运行所需的任何代码.

The next time a page is loaded and the client has reached a set limit you can then run what ever code you want.

解析每个页面加载的日志似乎确实很耗时.

Parsing the log each page load though does seem like it would be time consuming.

这就是某些网站统计程序如何获取该信息.

Thats how some website statistic programs get that info.

编辑

一些日志文件在某些​​时候也会被存档,例如我的每个星期日都在早上6点重新开始,因此,如果用户在这段时间内浏览,则他们的访问历史记录将在6点后消失,因此在数据库中节省了客户端带宽一种始终保持该信息的方法

Also some log files get archived at certain points, like mine gets a fresh start every Sunday at 6am so if a user was browsing during that time, their access history would disapear after 6, so saving the clients bandwidth in a database is a way to keep that information all the time

这篇关于使用PHP应用程序跟踪用户带宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆