Excellent, thanks both for the suggestions. I'd like to continue hosting it 
myself if for no other reason than I want to learn how to manage some of the 
hardware, software and operating systems that I otherwise don't get much 
exposure to. I'm treating this as a learning experience.

I like the idea of the file_get_contents() as it sounds easier to implement, 
but, again, I'm using this as a learning experience so maybe I'll try and parse 
out the log files as you suggest.

Again, many thanks!
Dave

---------- Original Message ----------
From: "Michael A. Peters" <mpet...@mac.com>
To: Yannick Mortier <mvmort...@googlemail.com>
Cc: JD <danceintherai...@netzero.com>, php-general@lists.php.net
Subject: Re: [PHP] PHP bandwidth control
Date: Mon, 06 Apr 2009 06:03:12 -0700

Yannick Mortier wrote:
> 2009/4/6 JD <danceintherai...@netzero.com>:
>> Hello,
>>
>> 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 PHP?
>>
>> Thanks,
>> Dave
>>
>> ____________________________________________________________
>> Click here for free information on how to reduce your debt by filing for 
>> bankruptcy.
>> http://thirdpartyoffers.netzero.net/TGL2231/fc/BLSrjnxXKInZ3kl2SDnqN7ifO3PSaE96m9RMpRCn9agvvsomFpM5Y0grTAM/
>>
>> --
>> 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
> message.
> 
> 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.
> 

My suggestion would be to do it on a real server and avoid any and all 
ISP restrictions, present and future.

Don't register your domain with your host though, I found it to be a 
real PITA to switch hosts when you use them as your registrar, getting 
them to relinquish control of the domain can be a PITA.

Instead register with someone like godaddy that lets you specify the 
nameservers and host elsewhere. Then if you feel like you need to move 
it to a different host, your current host can't be jerks about it.


____________________________________________________________
Purify your water with professional water treatment. Click now!
http://thirdpartyoffers.netzero.net/TGL2231/fc/BLSrjnxWi0WoglDK0IWRPkII8DwKjpWYPNFWYl5H4goF180aUp9479wxiL2/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to