跟踪用户的带宽
我正在建立一个网站,用户可以在其中拥有自己的免费网站。他们可以上传图片、添加内容、定制主题/设计等等......全部免费。我想将每个用户面板/站点的每月带宽限制为 1GB,或者至少跟踪它。
每个用户站点都是 wwww.myfreesites(ie).com/[username]/
该网站在 Linux 上运行(如果有帮助的话)。
理想情况下,我希望 PHP 跟踪每个用户的带宽使用情况,并在当月/日回到开始时限制 1GB 时锁定帐户(通过 mysql 查询)。
谢谢!`
I'm building a site where users can have their own free sites. They can upload pictures, add content, customize themes / designs and etc... all free. I want to limit each users panel / site to 1GB monthly bandwidth or at least track it.
Each users site would be wwww.myfreesites(ie).com/[username]/
The web site runs on linux (if that helps).
Ideally, I'd like PHP to track each users bandwidth usage and lock the account (via mysql query) when 1GB is limited on the month / day is back to the beginning.
Thanks!`
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
用 PHP 构建一个界面,他们通过该界面上传内容。这样您就可以看到他们上传了多少内容。不过,获取流量消耗的带宽可能会比较棘手。
我建议使用服务器生成的日志并构建一个脚本来解析数据以计算下载对象的流量和大小。我不确定哪个日志会给你这个信息,但如果你联系托管公司(假设你会使用专用服务器),他们肯定可以告诉你。
Build an interface in PHP through which they upload content. This way you can see how much content they uploaded. Getting the bandwith consumed by traffic though can be trickier.
I'd suggest using the server generated logs and build a script that parses the data to calculate the amount of traffic and size of the downloaded objects. I'm not sure which log would give you that but if you contact the hosting company (suppose you'd use a dedicated server) they can surely tell you.