RE: [PHP] Help with file not writing

From: Date: Tue, 25 Jan 2005 16:32:26 +0000
Subject: RE: [PHP] Help with file not writing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-207249@lists.php.net to get a copy of this message
Hi Marek, I don't see anything in the docs located http://us3.php.net/fopen to help. I changed it to w only but that made no difference. Can you please provide a more specific answer. THanks Code looks liks this: <% class counter { var $log_file = 'counters/google_log.txt'; var $file = 'counters/google_counter.txt'; function counter() { $this->readFile(); $this->writeFile(); $this->writeLog(); } function readFile() { $hiti = fopen($this->file, "r"); while(!feof($hiti)){ $this->$hits .= fgets($hiti,128); } $this->$hits=1+$this->$hits; echo $this->$hits; fclose($hiti); } function writeFile() { $hito = fopen($this->file,"w+"); fputs($hito,$this->$hits); fclose($hito); } function writeLog() { $ip_address=$GLOBALS['HTTP_SERVER_VARS']['REMOTE_ADDR']; $date_stamp=date("F j, Y, g:i a"); $log_entry=$date_stamp . " : " . $ip_address . "\n" ; echo "TEST-> " . $log_entry ; $log = fopen($this->log_file,"a"); fputs($log,$this->$log_entry ); fclose($log); } } %>

« previous php.general (#207249) next »