Hello,
I have a script (at bottom) that, upon loading, will randomly select a
mirror or primary server (on average, the primary servers will be selected
twice as much). It all works good, but now, I have to add a "quota manager"
that will, for both mirrors, limit the times the file can be downloaded to
1200 times (there is only one file being downloaded). I have thought about
storing a text file for each of the two mirrors that shows the current count
of downloads, and it will be checked if the mirror is randomly selected and
if it is above 1200, will randomly select another server, and if it isn't,
will just add one to it and update the file. How would I go about this, or
is there a better way to do this?
Thanks in advance.
Andrew Conner

The script (I know it doesn't use the best design, but it works, any better
ways of doing this?):
----------------
<?

// This array holds the servers, and has a double entry for the primary
servers

$adArr = array("http://www.someprimaryserver.com/file.exe";,

"http://www.someprimaryserver.com/file.exe";,

"http://www.someprimaryserver2.com/file.exe";,

"http://www.someprimaryserver2.com/file.exe";,

"http://www.someprimaryserver3.com/file.exe";,

"http://www.someprimaryserver3.com/file.exe";,

"http://www.someprimaryserver4.com/file.exe";,

"http://www.someprimaryserver4.com/file.exe";,

"http://www.somemirror.com/file.exe";,

"http://www.somemirror2.com/file.exe";);

// This randomly gets a server...

srand((double)microtime()*1000000);

$wOne = rand(0, 9);

$choice = $adArr[$wOne];

// This fwds the user to the server picked.

// Somewhere in here needs to be the mirror stuff...

header("Location: $choice");

?>




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

Reply via email to