summaryrefslogtreecommitdiff
path: root/inc/io.php
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-04-22 22:08:17 +0200
committerandi <andi@splitbrain.org>2005-04-22 22:08:17 +0200
commit0e33fac4b16215d2ffc9145870ae34b84a9a4331 (patch)
treebffb5118c1ef116f89d9656a277b7ca65d3c88ec /inc/io.php
parentbce5c1da225a8a1c1e174161676aadbed8f2b4e1 (diff)
downloadrpg-0e33fac4b16215d2ffc9145870ae34b84a9a4331.tar.gz
rpg-0e33fac4b16215d2ffc9145870ae34b84a9a4331.tar.bz2
size and timelimit for io_download
darcs-hash:20050422200817-9977f-ccce2966eaa4258cf7a3ea29f9728108e501ab33.gz
Diffstat (limited to 'inc/io.php')
-rw-r--r--inc/io.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/inc/io.php b/inc/io.php
index 85cba7421..6c31cffc7 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -210,7 +210,14 @@ function io_download($url,$file){
$fp = @fopen($url,"rb");
if(!$fp) return false;
+ $kb = 0;
+ $now = time();
+
while(!feof($fp)){
+ if($kb++ > 2048 || (time() - $now) > 45){
+ //abort on 2 MB and timeout on 45 sec
+ return false;
+ }
$cont.= fread($fp,1024);
}
fclose($fp);