|
 tchibomann - 2008-09-25 13:34:19
Hello Andrey,
have you really tested your package? I don't think so, sorry.
The idea about this package is great, that's a fact. But there are some bugs...
in the file "getfile.php":
- don't make a html-output BEFORE session_start(). In this case, there will be no sessioncookie set.
- don't use in_array(), if you want to search a multiple array for a key-value. use array_key_exists($what, $array['name'])
Your biggest bug is in the file little_leech.php. You cannot use file_get_contents() to read a file and send it out to the user. i only get about 277bytes of a 1MiB, 100MiB and 1GiB file - not more.
a better way to read and put out a file to the user, is to read and cache 1024 bytes from a file, put it out, delete the cache and read the next 1024bytes from the file. This method works fine with big files, i wrote such a download protection script, too.
Keep working ;)
Greetings, Patrick
PS: Sorry for my english^^
 Andrey Nikishaev - 2008-09-27 08:58:05 - In reply to message 1 from tchibomann
Thank's for you reply)
About first bug. I know that session_start() sends a header, but it was morning so i not very good saw what i'm doing))
About second. I agree with you, i didn't think about that.
All bugs was fixed. Thank you for your help)
Best Regards,
Andrew.
 tchibomann - 2008-09-27 12:56:08 - In reply to message 2 from Andrey Nikishaev
Hey Andrey,
i know that^^ coding in the morning - no good idea :D
there are 2 other things. Firstly on line 15 in getfile.php - change in_array() to array_key_exists(), otherwise there will be a warning-output from php.
secondly: i forgot to tell you, that you have to set the php execution time. the standard php execution time is 30 seconds, but that's in most cases not enough. With a downloadspeed about 6Mbit you'll get only about 33MB from a big file, so you have to set a bigger execution time.
ini_set('max_execution_time','3600');
This will set the execution_time on 1 hour. Should be enouth for 1GiB Files at 1Mbit downloadspeed. Bigger is better.
But i think this will not work everywhere. I've testet this only on rootservers, windows and linux.
 tchibomann - 2008-09-27 13:01:00 - In reply to message 3 from tchibomann
Mh no edtit functions here? shit^^
You'll need not 1 hour for a 1GiB file at 1Mbit Downloadspeed, you'll need three hours. So, i think it's a good idea to set the execution time on 10 hours for really large files...
Best regards,
Patrick
 Andrey Nikishaev - 2008-09-28 08:35:06 - In reply to message 4 from tchibomann
all done)
thank you)
 tchibomann - 2008-09-28 13:51:58 - In reply to message 5 from Andrey Nikishaev
Now it looks perfect ;) Good work.
Best Regards,
Patrick
 Rachael P - 2008-09-30 20:13:50 - In reply to message 6 from tchibomann
Ok Maybe I'm too new to know a lot, but how is this program run via the page? <a href="what goes here?">
Rachael
PHP newbie
 tchibomann - 2008-10-01 00:25:16 - In reply to message 7 from Rachael P
Hello :)
ah it's a bit tricky, it's better you know the basics about PHP. The best way is using the code of getfile.php in your own PHP-Script. This way don't work in simple html-pages, only works in php files.
you _can_ use the getfile.php as a "stand-alone" program, in this case you only have to write as html-link:
<a href="http://domain.com/path/to/getfile.php?f=file_name.ext">Click here to go to the download-link</a>
Then getfile.php will show you the "real" clickable downloadlink. But i think this way really don't looks great...
 Rachael P - 2008-10-01 01:41:18 - In reply to message 8 from tchibomann
Thank you. Could you help me?
Rachael
PHP newbie
 Andrey Nikishaev - 2008-10-01 13:55:46 - In reply to message 9 from Rachael P
Please describe yuor problem in details.
|