Bandwidth and download question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Samir

    #1

    Bandwidth and download question

    Hello,

    I have a website that is hosted by another company. Is there some kind
    of php script to limit downloading to a certain amount size? And is
    there kind thing I can do to the .htaccess file to limit this as
    well???

    For example I have a little media file say about 3MB or something.
    Once someone visits the site and wants to download this file (ie.
    http://www.domain.com/dir/file.wmv), I would like something check
    something to see if they have the max download per day before it lets
    them download it.

    thanks for any help.

  • Samir

    #2
    Re: Bandwidth and download question

    I also want to add, it doesn't have to limit the wmv file, whatever
    file is in a directory as well.

    Comment

    • Joe Webster

      #3
      Re: Bandwidth and download question

      "Samir" <dlx_son@yahoo. com> wrote in message
      news:1111095834 .947967.110700@ z14g2000cwz.goo glegroups.com.. .[color=blue]
      > I also want to add, it doesn't have to limit the wmv file, whatever
      > file is in a directory as well.
      >[/color]

      This is really something handled better by the webserver software (i.e.
      apache). It COULD be done w/ PHP, but it would be a little tricky.

      -Joe


      Comment

      • NC

        #4
        Re: Bandwidth and download question

        Samir wrote:[color=blue]
        >
        > I have a website that is hosted by another company.
        > Is there some kind of php script to limit downloading
        > to a certain amount size?[/color]

        This is not a trivial task. It is possible to create a
        script that will keep track of files that users ATTEMPTED
        to download. Whether those downloads succeeded or not is
        difficult to tell from the server side...

        Cheers,
        NC

        Comment

        • Samir

          #5
          Re: Bandwidth and download question

          Where would the best place to do? Can you give me some pointers and
          hints?

          Comment

          • NC

            #6
            Re: Bandwidth and download question

            Samir wrote:[color=blue]
            >
            > Where would the best place to do? Can you give me some
            > pointers and hints?[/color]

            OK, if I understand your problem correctly, you need an
            application with four major functions:

            1. Authorization
            A user must provide valid credentials (login name and
            password) before using the service. User data (login
            name, hash of password, e-mail address and any other
            information you require at sign-up) should be stored
            in a database table. If you plan to have different
            download quotas for different users, this should also
            be reflected in this table.

            2. File storage
            Files should be stored in a directory protected from
            direct access via HTTP (either located outside of document
            root or blocked with a "deny from all" directive in
            an .htacces file). Basic information about files
            (name, size, and perhaps MIME type) shoule be stored
            in another database table.

            3. Accounting and delivery
            Downloads should be implemented via PHP script. Let's
            say a properly authorized used requests file whose
            ID number is 234. A query executed on the file
            storage data table returns that file number 234 is
            named 'somesong.mp3', is 1,234,567 bytes long, and
            has a MIME type 'application/mp3'. Then, you can
            implement the download like this:

            header('Content-Type: application/mp3');
            header('Content-Disposition: attachment; filename=someso ng.mp3');
            header('Content-Length: 1234567');
            readfile('files/somesomg.mp3');

            Direct downloads from file storage directory should not
            be allowed. Every attempted download via script should
            be recorded in a third database table listing user ID,
            time of download, and the ID of file being downloaded.
            Prior to the commencement of the download, a check should
            be run on whether the user has exceeded his/her download
            quota.

            4. Administration
            The project administrator (meaning, you) should have
            a Web interface for file uploads, managing users, etc.

            Scared yet? :)

            Cheers,
            NC

            Comment

            • Samir

              #7
              Re: Bandwidth and download question

              Thanks for all the info...I am testing out the phpnuke, it is something
              I am going for. I have managed to set up links in a hidden directory
              for download and disguise the link as well. I finished writing the
              script by checking whether or not they are a registered user or not as
              well. I learned quite a bit. I did things a little differently but I
              like the ways yours was written as well for hiding the download file.

              Just one more thing I guess, Is there a way to deteremine whether a
              file has finished downloading or not. I just don't want to count the
              click as a download without knowing whether the download completed or
              just cancled by the user. I think I am trying to say I would like to
              know if there is a way to count how many bytes the user has taken at
              the finish of the dowload or cancel button.

              Thanks again:)

              Comment

              Working...