$sql = sprintf("SELECT UNIX_TIMESTAMP(last_access) last_time FROM downloaded WHERE filepath = '%s' AND ipadres = '%s' ORDER BY last_access DESC", $file, $ip); $res = mysql_query($sql); if (mysql_num_rows($res) > 0) {
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #13 on: Jul 07, 2007, 02:43:59 pm »
... hm, I'm still not sure if this will work with these download managers...
and what if the user need to download a CD (900 GB) and has a slow connection and need several attempts (using a DL manager) this way the use has created x * 900GB as traffic...
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #14 on: Jul 07, 2007, 02:48:24 pm »
This wont work with download managers.
To make it work with a download manager you need to work it out more. Check this directive :
To make it work with a download manager you need to work it out more. Check this directive :
$_SERVER['HTTP_RANGE']
I know I use this function to have this resume function:
Code:
<?php function dl_file_resume($file){
//First, see if the file exists if (!is_file($file)) { die("<b>404 File not found!</b>"); }
//Gather relevent info about file $len = filesize($file); $filename = basename($file); $file_extension = strtolower(substr(strrchr($filename,"."),1));
//This will set the Content-Type to the appropriate setting for the file switch( $file_extension ) { case "exe": $ctype="application/octet-stream"; break; case "zip": $ctype="application/zip"; break; case "mp3": $ctype="audio/mpeg"; break; case "mpg":$ctype="video/mpeg"; break; case "avi": $ctype="video/x-msvideo"; break; default: $ctype="application/force-download"; }
So instead of using 5 concurrent connections it should allow 3?
1 or 2
is 5 a setting I can change on my server?
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« Reply #19 on: Jul 07, 2007, 03:21:28 pm »
You should do that yourself, by checking how many times the user entered the if(isset($_SERVER['HTTP_RANGE'])) {?> and I am not sure if this is going to work.