php - Making a special download page -
i want create download page.and want offer 2 kinds of download option users:
->download fast server(users pay 1 dollar download , download @ full speed)
->download slow server(free download speed should 70-100kb/s)
i newbie , glad if can explain me how to: 1)put download speed limit 2)make free , premium subscription users while keeping in mind free users low speed 3)integrating paypal payment method premium users appreciated.
thanks in advance
what you're looking called mod_ratelimit apache httpd, or limit_rate directive nginx.
don't rely on php handle entire download process since you'd tying entire php worker no added benefit. instead, can rely on using php handle authentication mechanism of subjugating download uri , use x-sendfile headers apache httpd mod_xsendfile, example, handle actual download.
this simple doing following in php...
<?php session_start(); if ($_session['authed']) { header("x-sendfile: /path/to/download/foo.zip"); } else { header('location: /authenticate'); } some of benefits relying on webserver serve file include:
- optimal delivery (takes advantage of mmap available)
- processes cache headers correctly (as if file served statically)
- doesn't tie php process duration of download, making available serve other requests need php other delivering static content.
Comments
Post a Comment