Tracking user bandwidth using a PHP application

I am working on a campus project using PHP and CodeIgniter.
This is only a project for my assignment.
Then it comes that I have to limit the bandwidth used by the user (applications, not linux user).
And I have no idea to implement this.
I wonder if anyone knows the logic or is ever working on similar tasks.
What I basically need, how to track the bandwidth of a user (a system user, not Linux)?
Should I count all requests and responses for this user?
How to calculate the loading of images and static files for a specific user system?
Any advice is appreciated.

Thaks
Ivan

+1
source share
1 answer

One of the only ways I can think (using php) is to analyze the web server's access.log and add bandwidth for each client.

The next time the page is loaded and the client reaches the set limit, you can run any code you want.

Analysis of the logarithm of the loading of each page, although it seems that it will take a lot of time.

Here's how some website statistics programs get this information.

EDIT

Also, some log files are archived at certain points, for example, I get a fresh start every Sunday at 6 a.m., so if the user looked at this time, their access history would disappear after 6, so saving client bandwidth in the database is a way to keep this information all the time

+2
source

All Articles