note 69970 added to function.copy

From: Date: Thu, 28 Sep 2006 13:14:15 +0000
Subject: note 69970 added to function.copy
Groups: php.notes 
Request: Send a blank email to php-notes+get-117771@lists.php.net to get a copy of this message
Hi all. I'm from Slovakia. I've made this script for downloading files from remote server to the local server: <?php /* PASSWORD */ $good_passw = "your_passw"; /* LOCAL DIRECTORY */ $dir = "../dwnl/"; if (isset($_REQUEST['remote_file']) && isset($_REQUEST['passw'])) { if (strpos($_REQUEST['remote_file'],"://") === false) die("Bad file!"); if ($_REQUEST['passw'] != $good_passw) die("Bad password!"); copy($_REQUEST['remote_file'], $dir.basename($_REQUEST['remote_file'])); die("OK."); } ?> <form name="dwnl" action="d.php" method="post" target="_blank"> <input type="text" name="remote_file"/> <input type="password" name="passw"/> <input type="submit" value="[OK]"/> </form> PHP doesn't check max. script execution time while executing the copy() function. So you can use it at any server, even if you don't have permission to change max. script execution time. Closing the browser window doesn't cause script execution end. But there's also some problem. When copying big files (e.g. 2.5 GB), this script ends and prints 'OK', even if only 9MB of file were copied. ---- Server IP: 62.65.181.66 Probable Submitter: 84.47.49.106 ---- Manual Page -- http://www.php.net/manual/en/function.copy.php Edit -- https://master.php.net/note/edit/69970 Del: integrated -- https://master.php.net/note/delete/69970/integrated Del: useless -- https://master.php.net/note/delete/69970/useless Del: bad code -- https://master.php.net/note/delete/69970/bad+code Del: spam -- https://master.php.net/note/delete/69970/spam Del: non-english -- https://master.php.net/note/delete/69970/non-english Del: in docs -- https://master.php.net/note/delete/69970/in+docs Del: other reasons-- https://master.php.net/note/delete/69970 Reject -- https://master.php.net/note/reject/69970 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117771) next »