|
|
|
||||
|
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() |
|
|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
|
Thread Tools |
|
|
#1 |
|
Confirmed User
Join Date: May 2004
Posts: 210
|
Fellow coders I need some advice
I want to make a script that restricts the member area bandwidth usage per member per hour. My question is how do I check the used bandwidth without having to pass all content through scripts. So far the only whatso usable solution to this problem is using iptables for bandwidth info per IP. If anybody can give me any advice, it'd be greatly appreciated.
Thanks in advance, Andrew P.S. Hope you all have a Happy New Year
__________________
-- ClickBuster -- ICQ# 263653704 -- Email: clickbuster1 [-at-] gmail [-dot-] com |
|
|
|
|
|
#2 |
|
So Fucking Banned
Join Date: Nov 2005
Location: Netherlands
Posts: 468
|
Think ftvcash does this how much you can allow per day, stops people from downloading everything
|
|
|
|
|
|
#3 |
|
Confirmed User
Join Date: May 2004
Posts: 210
|
Many sites have that actually
__________________
-- ClickBuster -- ICQ# 263653704 -- Email: clickbuster1 [-at-] gmail [-dot-] com |
|
|
|
|
|
#4 |
|
Confirmed User
Industry Role:
Join Date: Mar 2007
Posts: 7,771
|
Build a table with the content size of each piece of media.
Use a redirect script (like traffic trading: /cgi-bin/media.cgi?url=/themedia.mpg) to print "location: /themedia.mpg\n\n" The redirect script reads the content size table based on the url and adds to a cookie and IP file the total amount of bandwidth and redirects to an error page if bandwidth exceeded. There's several other ways but this is probably the easiest. Using htaccess to hide the redirect script can help make it harder to defeat.
__________________
![]() ![]()
|
|
|
|
|
|
#5 | |
|
Confirmed User
Join Date: Aug 2003
Location: Austin, TX
Posts: 4,090
|
Quote:
good idea, but this assumes that the person viewed the entire file... so if the mpg file is 400meg, and they got their satisfaction around 100meg point, then they got "over charged" (assuming content was streaming vs. downlaoded as a whole clip). you can have a background cron job that runs every minute that does b/w stat checks by IP (as you were thinking) to fill in a table, and your PHP script checks that table based on IP. (this method would help with streamed content) Most ppl have the same IP during their session with you... AOL users can have IP change in the middle of their time on your site... Fight the .02!
__________________
http://www.t3report.com (where's the traffic?) v5.0 is out! | http://www.FightThePatent.com | ICQ 52741957 |
|
|
|
|
|
|
#6 |
|
Confirmed User
Join Date: Jun 2007
Posts: 160
|
afaik, there are some robust production grade scripts available for this... I think guy who made strongbox has script for this too (it's actualy an apache module)
|
|
|
|
|
|
#7 | |
|
Confirmed User
Join Date: Aug 2003
Location: Austin, TX
Posts: 4,090
|
Quote:
ah, yes, apache modules... found this: http://digg.com/linux_unix/Manage_Ap...th_ mod_cband Fight the 411!
__________________
http://www.t3report.com (where's the traffic?) v5.0 is out! | http://www.FightThePatent.com | ICQ 52741957 |
|
|
|
|
|
|
#8 | |
|
Confirmed User
Join Date: May 2004
Posts: 210
|
Quote:
__________________
-- ClickBuster -- ICQ# 263653704 -- Email: clickbuster1 [-at-] gmail [-dot-] com |
|
|
|
|
|
|
#9 | |
|
Confirmed User
Industry Role:
Join Date: Mar 2007
Posts: 7,771
|
Quote:
![]() $n="dontstop"; while ($n eq "dontstop") { &manage_bandwidth; sleep(60); if (-e "killme.txt") {exit;} }
__________________
![]() ![]()
|
|
|
|
|
|
|
#10 |
|
Confirmed User
Join Date: Mar 2006
Posts: 591
|
Doesnt Throttlebox do this?
|
|
|
|
|
|
#11 |
|
Confirmed User
Join Date: May 2004
Posts: 210
|
:D 1337 but I need a bit more explanation to your prop...
__________________
-- ClickBuster -- ICQ# 263653704 -- Email: clickbuster1 [-at-] gmail [-dot-] com |
|
|
|
|
|
#12 |
|
MFBA
Industry Role:
Join Date: Mar 2003
Location: PNW
Posts: 7,230
|
there are numerous apache modules that do this.
|
|
|
|
|
|
#13 |
|
MFBA
Industry Role:
Join Date: Mar 2003
Location: PNW
Posts: 7,230
|
its a script that runs an endless loop every 60 seconds because $n never changes it just keeps looping with a 60 second sleep(pause) in the middle. the second to last line checks for the existence of a file, which could be used to turn it on or off. make sense?
|
|
|
|
|
|
#14 |
|
Confirmed User
Join Date: May 2004
Posts: 210
|
What if Apache timesout? Also, you can perform only JS redirects after the output. Any specific Apache module suggestions?
__________________
-- ClickBuster -- ICQ# 263653704 -- Email: clickbuster1 [-at-] gmail [-dot-] com |
|
|
|
|
|
#15 | |
|
Confirmed User
Industry Role:
Join Date: Mar 2007
Posts: 7,771
|
Quote:
The "&manage_bandwidth" is a subroutine to do whatever you want. If you have dedicated server then this is easy way to do some things but maybe some host is paranoid on shared hosting and don't like it. It's just a choice other than cron; not better in anyway.
__________________
![]() ![]()
|
|
|
|
|
|
|
#16 |
|
Too lazy to set a custom title
Join Date: Mar 2002
Location: Australia
Posts: 17,393
|
Apache logs show both (a) the authenticated member name and (b) the size of the object it has delivered. It shouldn't be hard to write a script that continuously "tails" the logs and keeps stats on how much each member has downloaded. You could then set up something to modify/rewrite htaccess to redirect any further requests from that member to a page explaining that they've exceeded their quota.
Are you actually having a problem with excessive downloads or are you just being careful? Sometimes pissing off members may cost you more than savings in bw. ![]() |
|
|
|
|
|
#17 |
|
Confirmed User
Industry Role:
Join Date: Mar 2007
Posts: 7,771
|
NOTE: to my last post.
The "killme.txt" file can only turn it off! I has to be executed again to restart.
__________________
![]() ![]()
|
|
|
|
|
|
#18 |
|
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,231
|
cron is still better to use then because if you reboot the box it will still do what needs to be done.
as for the issue at hand, I can't think of any way you could limit this outside of an apache module.
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
|
|
|
|
|
#19 | |
|
Confirmed User
Join Date: May 2004
Posts: 210
|
Quote:
__________________
-- ClickBuster -- ICQ# 263653704 -- Email: clickbuster1 [-at-] gmail [-dot-] com |
|
|
|
|
|
|
#20 | |
|
Too lazy to set a custom title
Join Date: Mar 2002
Location: Australia
Posts: 17,393
|
Quote:
|
|
|
|
|
|
|
#21 | |
|
Confirmed User
Join Date: Oct 2002
Posts: 3,745
|
Quote:
ITELLIGENT way. Just counting bandwidth without more intelligence than that seems to cause more problems than it solves. I wouldn't want to redirect every hit, or even count everything through iptables, the overhead seems to high to me. Instead we track bandwidth only when it actually matters, and we do it using a custom Apache module. This is something we worked on for a few years, so you may find that it makes much more sense to take advantage of all of the time that we spent on this, all of the research, the discussions we had with university professors about declining averages, etc. rather than either doing all of that work over again yourself or skipping the hard part and building something that doesn't work so well.
__________________
For historical display only. This information is not current: support@bettercgi.com ICQ 7208627 Strongbox - The next generation in site security Throttlebox - The next generation in bandwidth control Clonebox - Backup and disaster recovery on steroids |
|
|
|
|
|
|
#22 | |
|
Confirmed User
Join Date: May 2004
Posts: 210
|
Quote:
__________________
-- ClickBuster -- ICQ# 263653704 -- Email: clickbuster1 [-at-] gmail [-dot-] com |
|
|
|
|
|
|
#23 |
|
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,231
|
Give mod_leech a shot,
http://toroid.org/ams/mod_leech
__________________
Mechanical Bunny Media Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development |
|
|
|
|
|
#24 | |
|
Confirmed User
Join Date: May 2004
Posts: 210
|
Quote:
Edit: ROFL the shady hosting company name got changed to hahahahahaha
__________________
-- ClickBuster -- ICQ# 263653704 -- Email: clickbuster1 [-at-] gmail [-dot-] com |
|
|
|
|
|
|
#25 |
|
Confirmed User
Join Date: Oct 2002
Posts: 3,745
|
Ok, good luck with it. Be forwarned to get something to actually work well and not create problems is a bigger job than it first appears.
__________________
For historical display only. This information is not current: support@bettercgi.com ICQ 7208627 Strongbox - The next generation in site security Throttlebox - The next generation in bandwidth control Clonebox - Backup and disaster recovery on steroids |
|
|
|