I am creating a bandwidth quota program in PHP, however I am finding that to create it with PHP is a bit hard. As an example of what I am trying to do, the user can download 10GB per day, and after they have reached the bandwidth cap the user should be unable to connect.
I would like to find a program to record how much bandwidth the remote host uses (per remote IP address and remote port). The remote port is important to be able to identify that the user behind a NAT has downloaded the file.
I would like to know if it's possible to monitor a remote host not by IP but by username? Can I track how much bandwidth the user uses, making this more simple? It's something like the rapidshare trafficshare system. I need a system like this!
Can you give me some ideas and pointers how to create a system like this using PHP or any scripting language? I really appreciate it!