|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2005-03-31 16:13 UTC] php-bugs at lists dot php dot net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 10:00:02 2025 UTC | 
A counter function written in php and using gdbm is no more working. the dbmfetch funktion returns empty string, while dbmexists indicates the existence of an string. looking into the dbm file shows the value is there. I include first the output of two different systems (the first is th buggy one) and then the php script. ---------- PHP mit dbm: Datei: /home4/kredel/public_html/ex51.phtml. open: 1 key: /home4/kredel/public_html/ex51.phtml found: #### put: 1 replace: 1 1 Zugriffe, Ge?ndert am 01 Feb 2000 12:38:08 DB Version: This is GDBM version 1.7.3, as of May 19, 1994. Hostname: trumpf-5.rz.uni-mannheim.de Server Software: Apache/1.3.9 (Unix) PHP/3.0.12 ---------- PHP mit dbm: Datei: /home4/kredel/public_html/ex51.phtml. open: 1 key: /home4/kredel/public_html/ex51.phtml found: ##129## put: 130 replace: 130 130 Zugriffe, Ge?ndert am 01 Feb 2000 12:38:08 DB Version: This is GDBM version 1.7.3, as of May 19, 1994. Hostname: trumpf-4.rz.uni-mannheim.de Server Software: mod_perl/1.18 Apache/1.3.4 (Unix) (SuSE/Linux) PHP/3.0.7 ---------- <?php $filename=$SCRIPT_FILENAME; function modified($lang) { global $filename; $lm=date("d M Y H:i:s",filectime($filename)); if ($lang=="de") { return "Geändert am $lm"; } else { return "Last modified: $lm"; } } $filename=$SCRIPT_FILENAME; $counter_start="1"; function counter() { global $filename, $counter_start; $counter_dir="/tmp/"; $counter_db=$counter_dir . "zaehler.dbm"; if (file_exists("$counter_db")) { $db=dbmopen($counter_db,"w"); echo "<p>open: $db</p>"; echo "<p>key: $filename</p>"; if ( dbmexists($db,$filename) ) { $cnt=dbmfetch($db,$filename); echo "<p>found: ##$cnt##</p>"; if ($counter_start=="1") { $cnt++; } else { $cnt=$counter_start; } echo "<p>put: $cnt</p>"; dbmreplace($db,$filename,$cnt); echo "<p>replace: $cnt</p>"; } else { $cnt=$counter_start; dbminsert($db,$filename,$cnt); } dbmclose($db); return "$cnt"; } else { echo "Attempt to create file: " . $counter_db; $cnt=$counter_start; $db=dbmopen($counter_db,"n"); dbminsert($db,$filename,$cnt); dbmclose($db); return "$cnt"; } } ?> <html> <head> <title>php dbm</title> </head> <body> <p>PHP mit dbm:</p> <p> <?php /* $counter_start="9999"; */ echo "<h3>Datei: $SCRIPT_FILENAME.</h3>"; echo "<h3>" . counter(). " Zugriffe,"; echo " " . modified("de") . "</h3>"; $yyy=dblist(); echo "<p>DB Version: $yyy</p>"; echo "<p>Hostname: $HTTP_HOST</p>"; echo "<p>Server Software: $SERVER_SOFTWARE</p>"; ?> </body> ----------