webpage counters

From: Date: Wed, 05 Sep 2001 13:39:52 +0000
Subject: webpage counters
Groups: php.db 
Request: Send a blank email to php-db+get-12168@lists.php.net to get a copy of this message
Hi: I have two types of counters in my web site and I would like to know which one is better. a) the first one using a field in mysql table and updating it each time a visitor hits the page. b) the second one using a plaint text file using code like this: <? $counter_file = "counterfile.txt"; $linecounter = file($counter_file); $linecounter[0]++; $cf = fopen($counter_file, "w"); fputs($cf, "$linecounter[0]"); fclose($cf); echo "$linecounter[0]"; ?> in this case i had to change the permission of the file to: chmod 666 counterfile.txt My questions are: 1. Which is more efficient in terms of time, i.e. accessing a database or accessing a text file? 2. is the second counter secure? is there a possibility that the file counterfile.txt (with those permissions) can be used as a insecure door to my web server? Thanks in advance for your help. _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com

« previous php.db (#12168) next »