View previous topic :: View next topic |
Author |
Message |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Thu Jul 26, 2007 9:01 am Post subject: PHP headers question |
|
|
Hello Everyone,
I'm writing a PHP script that limits a certain number of connections to a file but I want to have a way to tell the download resuming clients when the maximum number of connections have been reached so that it stops at a certain amount of connections. What header can I use?
Edit: I believe the Error 503 will fix this. I think I fixed the problem but feel free to post if you know of a better way.
Sample Code:
Code: | <?php
$connects = 2; // Active connections
$max_connects = 4; // Maximum connections allowed
if ($connects <= $max_connects)
{
...send the file
}
else
{
header("HTTP/1.1 503 Service Unavailable");
header("Retry-After: 30"); // let the client retry every 30 secs.
}
?>
|
Kind regards, Josh
Last edited by TRUSTAbyss on Thu Jul 26, 2007 5:58 pm; edited 1 time in total |
|
Back to top |
|
 |
roganty -
Joined: 08 Jun 2004 Posts: 357 Location: Bristol, UK
|
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Thu Jul 26, 2007 5:59 pm Post subject: |
|
|
Thanks roganty! I think the syntax is correct now. |
|
Back to top |
|
 |
|