Sign in to follow this  
Followers 0
sugi

Notify on a new post

11 posts in this topic

#1 ·  Posted (edited)

The script checks for new post in the AutoIt forum every 5 minutes. I guess you need to be logged in to the forum but I'm not sure. I know this is stupid but I just didn't know what else to do...

$TEMPFILE=@TempDir & 'checknewpost.tmp'
While 1
    $SKIPCACHE=''
    For $i = 0 to 8
        $SKIPCACHE=$SKIPCACHE & Chr(Int(Random(65,91)))
    Next
    If URLDownloadToFile('http://www.autoitscript.com/forum/index.php?skipcache='&$SKIPCACHE, $TEMPFILE) Then
        $File = FileRead($TEMPFILE, FileGetSize($TEMPFILE))
        If StringInStr($File, '/bf_new.gif') Then
            MsgBox(4096, 'New Post', 'There was a new post in the AutoIt Forum')
        EndIf
        FileDelete($TEMPFILE)
    EndIf
    Sleep(300000)
WEnd
Edited by sugi

Share this post


Link to post
Share on other sites



doesn't that eat bandwidth like mad? Reason I ask is I have my own forum and I know that people who check every few mins eat up my bandwidth every month :D

moo

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

doesn't that eat bandwidth like mad? Reason I ask is I have my own forum and I know that people who check every few mins eat up my bandwidth every month  :D

No. The reason is that the php file is ~30 KB in filesize. When you talk about people refreshing every couple of minutes, most of them are also re-loading the pictures, and any other files that are required to properly display the page. This script is much eaisier on servers, even if several hundred people use it. It's by far better than having those hundred people use an auto-reload plugin to reload the entire page.

Edit: Side note: this script is not useful to people that use Firefox (or any browser other than IE) since the UrlDownloadToFile function uses IE to do the downloading. Technically, to support those browsers, you'd have to somehow parse out the number of replies to each forum, and compare that to the last known value (prehaps stored in an ini file.)

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

actually from my server notes it's the PHP that is always the highest amount of bandwidth munching.. the gifs and jpg making up the skin and emoticons are barely noteable. You would think it would be the other way around I know.. but it's not. I use PHPBB though.. this is Phorum or something right?

moo

Share this post


Link to post
Share on other sites

Powered by Invision Power Board® v1.3 Final © 2003 IPS, Inc.

Share this post


Link to post
Share on other sites

actually from my server notes it's the PHP that is always the highest amount of bandwidth munching

I just did a "full page" download through my browser, and the php index file is 29 KB, but the rest of the files are 36 KB. You save over 50% of the bandwidth by parsing out only the php data. And if users are going to refresh the main page anyway, you want them doing it with your index alone. Also, cowsmanaut, what about users on your forum who might already be parsing using only your php index file? That would weight your results and make it seem like the php pages were a higher load.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

well the thing is the front page PHP reloads each time.. however the images can remain cached. So that's likley the reason it seems higher is that people *don't* refresh the images. However setting up something to frequently download the front page every 5 mins.. is kinda like a termite.. chips off tiny little chunks but does it fast enough to be noticed.. then what happens when you have 100 or more of them. It's just got me wondering if everyone on this board had this running whenever they were online.. it would quickly up bandwidth.

That's all I'm saying really..

moo

Share this post


Link to post
Share on other sites

True enough. I just did some more calculations, and discovered that 500 users using this script to download the ~30KB index page (assumed to be excatally 30 KB) once every 5 minutes would eat up 50 kB/s. Assuming it ran all the time (which is probably invalid, since some users would shut it down overnight) you would generate 123 GB of traffic per month.


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

Let us assume some more realistic stats. not everyone would use it.. so lets stay at 100. I mean your stats are scary enough but the idea that that many people would be using for that long is not very likley. However I would like to illustrate that it still has some impact.

100 users

30kb page

5 mins

100 * 30kb = 3000kb

5 * 12 = 1hour

3000 * 12 = 36000kb = 35.2MB (+some remainder)

if we then went and guessed say 2, 5 hour intervals since they may only have it one while they are infront of the computer.. it's logical right?

that would be 351.6MB rounded off. in just one day

if they only did this on the weekends you would be looking at 2.75 gigs traffic

Now, for me.. I only get 2 gigs of traffic and then I have to pay. I don't know what kind of deal they have here.. however for me it would close down my website. Since my forum is sponsored by me and me alone.

Autoit has a paypal account though so I hope they get enough in there to keep this going. There are a few sites that offer unlimited bandwidth but they don't do that for very long. :D (for obvisous reasons)

Oh well.. I'm just poking my nose in since I had an attack from MSNbot which is responsible for over a gig and a half of traffic to my site which had me shut down near the end of the month. Just a bot that was trying to check my site for information for search engines. So I'm more sensitive to the subject of bandwidth lately :huh2:

moo

Share this post


Link to post
Share on other sites

I didn't really meant this to be a script that was used in a live environment as there are far better ways... e.g. the Topic subscription that's available. It was more a proof of concept, that's why I've written that this was a stupid script :D

I just hope nobody gets a bad idea from this and really uses it...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0