Jump to content

How to control / monitor bandwidth in PHP ?


ankur0101

Recommended Posts

Hello,

I am planning to make a paid proxy website where users will have to pay for surfing.

It will cover following aspects..........

 

When user will create account, he will have to pay by PAYPAL only.

I want to provide instant activation i.e. when payment is made, it will instantly activate his account.

 

Every user will get specific amount of MB for surfing. Suppose Mr.X is having his limit of 500MB, then he should be able to check how much MB he is used, how much is remaining. When quota is over, his account will be deactivated.

 

So question is, I can manage user management, but how to make a/c activation after making payment ?

 

How can I manage Bandwidth quota for each user ?

 

Off course I am going to purchase VPS for this purpose.

 

Can anybody help me ? :) :)

Link to comment
https://forums.phpfreaks.com/topic/173312-how-to-control-monitor-bandwidth-in-php/
Share on other sites

What sort of bandwidth do you want to control? Data usage or speed? Data usage is easy -- just call count() on the data you retrieve or inspect the HTTP headers for Content-Length: which will tell you how long the document is. Then you can just store that somewhere temporarily (in a database for example) and do some comparisons:

 

<?php

if($dataUsedSoFar >= $dataLimit) {
return false; // or output a message if writing procedural code?
}

 

I don't know about limiting speed however. Maybe it's a question for your ISP who can limit those sorts of things? You might be able to do it in sockets, but I've never used sockets in PHP so I don't know. Anyone?

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.