SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    SitePoint Enthusiast abhai2k's Avatar
    Join Date
    Jun 2005
    Location
    India
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Download Controll

    I want to set up a download controll in which a person/ip add may not download more than one file at a time. ie if the ip is downloading a file then that ip add has to wait till the download is completed so that he/she can go to next download. Any ideas on how to do this...
    ( i saw the php.net and got familiar with ftp func is it possible to use ftp's onfinish func???)
    http://www.webblogged.com -Article on seo, web design and coding.

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    FTP's one way to handle it. I don't know much about PHP's FTP functions.

    You can pass all the downloads through a PHP script that keeps track of who's downloading and controls access to the files.

    Instead of linking directly to "file.zip", link to "download.php?file=file.zip". download.php can handle storing IP addresses in a database or whatever you need it to do. When you want to allow a download, PHP has readfile() to send the full contents of a file.

  3. #3
    SitePoint Enthusiast abhai2k's Avatar
    Join Date
    Jun 2005
    Location
    India
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well thats how i have written the current script
    It basically is a rapidshare clone. Here the files are uploaded PHP function and the link to download is according to the upload id. But FTp i am not used to. You know how its done???
    http://www.webblogged.com -Article on seo, web design and coding.

  4. #4
    Non-Member pbkill's Avatar
    Join Date
    Jan 2006
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is a very god way to do this using Apache and .htaccess. I can't remember how I did it but I will post back after I look at my script when I get home.

  5. #5
    SitePoint Enthusiast abhai2k's Avatar
    Join Date
    Jun 2005
    Location
    India
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it by any way possible to actually monitor the download ( without ftp) and keep checking the percentage done to a database ( cookie not so secure )???
    Like i have seen this cgi script which actually is an upload progress bar. So i was wonderring if it could be reverse engineered or something so that they get a progress bar for the download...
    http://www.webblogged.com -Article on seo, web design and coding.

  6. #6
    SitePoint Guru
    Join Date
    Jul 2005
    Location
    Orlando
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I haven't looked at it at all, but my understanding is the PHP will stop executing once the file download begins.

    PHP does it works, and reads the file and starts the download. After that, the script stops executing and it's all on the web server to finish the job.

    I'm sure there's a way, somehow, but I think the normal way of doing file downloads wouldn't let you know if the person has finished downloading.

  7. #7
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You could potentially do it. You can read and output X bytes of the file at a time while logging in-between.

  8. #8
    SitePoint Enthusiast abhai2k's Avatar
    Join Date
    Jun 2005
    Location
    India
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman
    You could potentially do it. You can read and output X bytes of the file at a time while logging in-between.
    Could you please show a demo or part of the code please...
    http://www.webblogged.com -Article on seo, web design and coding.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •