Time outs In downloads

Discussion in 'Site & Server Administration' started by .eXe, Jan 8, 2008.

  1. #1
    Hi

    I have a anime site and i want the members to have timeouts when downloading so they buy premium for unlimited downloads. How am i able to do timeouts?

    Im using PHP and HTML.

    Regards .eXe
     
    .eXe, Jan 8, 2008 IP
  2. ndreamer

    ndreamer Guest

    Messages:
    339
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    first person i have seen that actually wanted that to happen. the best thing to do is actually limit or slow the speed they download at, this can be done by slowing the output to the screen (sleep() in php) followed by a flush command.
     
    ndreamer, Jan 8, 2008 IP
  3. kissmyarse

    kissmyarse Peon

    Messages:
    100
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I agree with dreamer, making them timeout will just put them off, and they'll bounce.

    Two options in my eyes,

    1) As above, limit the speed people can download at...

    2) Use cookies to limit the number of files a user can retrieve in each session. A quick scout around the web reveals a nice bit of php which *may* do the trick. Note: It's not my work, but it looks like the kind of thing you could consider. I'm sure the coding section of DP could help if it is not 100% what you need.

    Good Luck!

    kma

    Call the download with: <a href='/dload.php?id=download1'>Download #1</a>
    
    <?
    global $HTTP_SESSION_VARS;
    session_start();
    
    // New visitor
    if (!isset($HTTP_SESSION_VARS['dload_cnt']))
    $HTTP_SESSION_VARS['dload_cnt'] = 0;
    
    // Check to see how many downloads they have had
    if ($HTTP_SESSION_VARS['dload_cnt'] >= 2)
    $url = 'reject.php';
    else
    {
    
    // If it's they haven't reached the limit, get the url for the requested download
    switch($id)
    {
    case 'download1':
    $url = '/dloads/files/file1.mp3';
    break;
    case 'download2':
    $url = '/dloads/files/file2.mp3';
    break;
    }
    $HTTP_SESSION_VARS['dload_cnt']++;
    }
    
    if (isset($url)) header("Location: $url");
    
    // don't include end, since we don't want to show page, we want to move to it
    ?>
    Code (markup):
     
    kissmyarse, Jan 8, 2008 IP