note 31053 added to function.readfile
| From: | php at ramihyn dot sytes dot net | Date: | Tue, 08 Apr 2003 13:41:13 +0000 |
| Subject: | note 31053 added to function.readfile | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46349@lists.php.net to get a copy of this message | ||
Hi,
i have a problem with a script using readfile():
----
$dbi = sql_connect($dbhost, $dbuser, $dbpass, $dbname);
sql_query("INSERT INTO jumpmaps_dl VALUES ('$id', '$client')", $dbi);
sql_query("UNLOCK TABLES", $dbi);
sql_logout($dbi);
header("Content-Type: application/x-zip-compressed");
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Length: $filesize");
header("Content-Transfer-Encoding: binary");
header("Expires: 0", true);
header("Pragma: no-cache");
readfile("$filepath/$filename");
$dbi = sql_connect($dbhost, $dbuser, $dbpass, $dbname);
if (!connection_aborted()) sql_query("UPDATE jumpmaps SET hits=hits+1 WHERE
id='$id'", $dbi);
while (!sql_query("LOCK TABLES jumpmaps_dl WRITE", $dbi)) {}
sql_query("DELETE FROM jumpmaps_dl WHERE (id='$id') and
(ip='$client')", $dbi);
sql_query("UNLOCK TABLES", $dbi);
sql_logout($dbi);
----
The problem is, php sometimes does NOT execute the commands after readfile(). Strange.
Same problem using fopen/fread/fclose.
--
http://www.php.net/manual/en/function.readfile.php
http://master.php.net/manage/user-notes.php?action=edit+31053
http://master.php.net/manage/user-notes.php?action=delete+31053
http://master.php.net/manage/user-notes.php?action=reject+31053