Jump to content


Trying to program a Round Robin Script

  • Please log in to reply
No replies to this topic

#1 Lostnode

  • Members
  • PipPipPip
  • Advanced Member
  • 77 posts

Posted 12 April 2006 - 02:18 PM

Ok, so here is what I am trying to do.
Basicaly I am trying to set up a makeshift load balancing script, so that every time I click a file download link it goes to a new server in a list. But I wanted to make the scriipt as easy as possible to update, so that I can scale the ammount of file links form 2 or 3 to like 50 or 80 and not have to do too much work.

So here was the idea behind it.

the links would look like "getfile.php?folder=foldername&file=filename" This woul make is fairly easy to keep the round robin small and easily updated.

Now getfile.php has an array of domains ($domain), for instance


Now when I click the link, it processes it and gives me back http://$domain/$folder/$file but in order, not a random selection, so the first click goes to sub1, the second sub2.

Here is the kicker though, if I add more sub domains or remove then, I don't want the scirpt to fail.

Now I am a complete newbie, I can pass variables and hack minor scripts, but this baffles me, I am not entrily sure how to set up arrays, but I can see via example, my problem though is the round robin part, how make it go from one domain to the next in line. I found one, however it required a script on the reciving end, which means I woul have to attach to a php file... the files I am looking at are anythign from a zip to a jpg and not a php document. So it basicaly needs to send the info via the link to incement.

Honestly I think I am a little out of my league beiung a newbie... it sounds so simple, but I don't think it is...

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users