Re: PHP bandwidth control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



DO NOT USE GO-DADDY.
Sorry, just had to say that Go-Daddy will cause all sorts of issues when your domain expires, or if you check for a domain but don't purchase it straight away. When you come back a little bit later you'll have to pay hundreds of dollars for the domain (as they registered it while you were gone), instead of the usual $20/yr type thing.

Try Planetdomain (although their website is being re-designed at the moment), MelbourneIT (expensive), or even Google (surprisingly cheap). Actually if you search, there's a website that has a list of the different domain registrars and their costs that you could look at.


As for quota control you can pipe everything through PHP which is more CPU intensive but will be more accurate in terms of which user was accessing the account. You could also parse the Apache log files (or whatever the web server is), which is more accurate but also slower.

For bandwidth you can use something like the bandwidth mod for Apache which will allow you to prevent your webserver from completely saturating your Internet connection, allowing you to still surf the net or play games while people are accessing your site.

Michael Kubler
*G*rey *P*hoenix *P*roductions <http://www.greyphoenix.biz>



JD wrote:
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" <mpeters@xxxxxxx>
To: Yannick Mortier <mvmortier@xxxxxxxxxxxxxx>
Cc: JD <danceintherain82@xxxxxxxxxxx>, php-general@xxxxxxxxxxxxx
Subject: Re:  PHP bandwidth control
Date: Mon, 06 Apr 2009 06:03:12 -0700

Yannick Mortier wrote:
2009/4/6 JD <danceintherain82@xxxxxxxxxxx>:
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/


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux