SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Nov 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation How to create good download.php???

    Hi everyone, long time no see

    Last time i visit this forum to ask about how to create a drag n drop cart, but there is no reply that satisfy me. Btw it's okay. I've give up on it. Now i just ask something simpler, about download mechanism. I don't know how to make a good download link that secure enough for a shopping site.

    My lecturer just ordered me to make it but she didn't taugh me how to. Maybe any of you can help me???

    I've tried googling using keyword like download mechanism and create download.php but there is no result that directing me to the answer.

    Thanks.

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could store a list of available downloads in a database table.

    Assuming you want you users to be logged in to be able to download, have another table where you can insert a record for a customer id, download file id, and maybe expiration or whatever your criteria is.

    Authenticate the user, and then search the database for downloads available to this user. Show them to the user. Provide them with links to your download script and pass arguments via the query string like download.php?file_id=1234

    download.php again checks with the database to make sure this user (still)has access to this file. The file can be output with readfile() or other related filesystem functions. You will need to send the proper http headers with header()

    You can do a web search for php force download and get some ideas.

    Security is another issue, as there's many areas of this where you need to be aware of potential for abuse.

  3. #3
    SitePoint Member
    Join Date
    Nov 2008
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Straight to the point. I like it. Thanks

  4. #4
    SitePoint Member
    Join Date
    Nov 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Snippets is a collection of PHP scripts for any web page development.


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
  •