mysql will always have overhead.  plus, IMO, mysql is overkill for just
simple page counters.

if i were you, keeping the text files outside the WEB DOC path would be
better.  they would have to crack into the machine itself... not just
the web server...  

Eduardo Vela wrote:
> 
> 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?
> 

-- 
Leo G. Divinagracia III
[EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to