|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-03-29 17:57 UTC] zirephoenix at rogers dot com
[2007-04-03 08:25 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 28 22:00:01 2025 UTC |
Description: ------------ Without the header() and imagegif() functions, the code is basically a hit counter script. However, with the combination of those two lines of code, the hit counter will increment by 2. Something is causing the script to run twice. Reproduce code: --------------- <?php $site="test.txt"; $imageFile="image/metro.gif"; $hits=0; if (file_exists($site)) { $temp=file($site); $hits=$temp[0]; } $hits++; $fileHandle=fopen($site, "w"); fputs($fileHandle, $hits); fclose($fileHandle); header("Content-type: image/gif"); imagegif(imagecreatefromgif($imageFile)); ?> Expected result: ---------------- test.txt should increment by 1 every time the script is accessed Actual result: -------------- test.txt increments by 2 every time the script is accessed