2009/4/6 JD <danceintherai...@netzero.com>:
> I am relatively new to PHP and am trying to make a video/image sharing site
> for my family to upload and share family videos and pictures. My concern is
> that because I'm hosting this site at my house, I will quickly exceed my
> bandwidth limitations each month if all the family members I think will use
> the site do actually end up using it. What I'd like to do is set up each
> family member with their own login and track how much bandwidth they use and
> cap it after a certain amount. The login stuff is easy and I have that
> figured out, but I haven't been able to figure out a good way to track the
> bandwidth used by each user that logs in. Is there a good way to do this with
> Click here for free information on how to reduce your debt by filing for
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
I guess there are multiple ways to engage this problem. It depends how
"deep" you want to log the traffic. If you just want to count the
traffic of each image, video etc you could just wrap up each image and
video to go through php first with file_get_contents() (look in the
php manual there are some examples how to work with this), count how
many bytes of data will be sent out and log this in a database or
however you want to do this.
If the bandwith limit is exceeded you don't deliver the image anymore
and display an error message instead.
If you want to catch all traffic you must parse the log files from you
webserver. To do this you could save the IP with which the login of
the user was performed and connect all traffic that was done by that
IP to the User. If the traffic limit is exceeded you display an error
I guess for some family-internal sharing the first approach should be
good enough. Just make sure you take some bandwith for the html pages
into your calculations.
Currently developing a browsergame...
Trade - Expand - Fight
Follow me on twitter!
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php