GraphCount - automatic log file creation
Posted: Sun Jan 20, 2008 7:29 am
/*************************************
Title: GraphCount log file automatic creation
Version: 1.0
Author: Kathy Leslie
Demo: www.goldwing.org.au
Description:
Inserted the following code in graphcount.php to automatically create the text log file if it doesn't exist so that a counter is always displayed.
*************************************/
Insert the following code before the "if (file_exists($logfile)) {" line - should be about line 57
/* Create the log if it doesn't exist */
if (!file_exists($logfile)) {
$fp = fopen($logfile, "w") or die('ERROR: Can\'t write to the log file ('.$logfile.'), please make sure this file exists and is CHMOD to 666 (rw-rw-rw-)!');
$count = 0;
flock($fp, LOCK_EX);
fputs($fp, $count);
flock($fp, LOCK_UN);
fclose($fp);
chmod($logfile, 0666);
}
Title: GraphCount log file automatic creation
Version: 1.0
Author: Kathy Leslie
Demo: www.goldwing.org.au
Description:
Inserted the following code in graphcount.php to automatically create the text log file if it doesn't exist so that a counter is always displayed.
*************************************/
Insert the following code before the "if (file_exists($logfile)) {" line - should be about line 57
/* Create the log if it doesn't exist */
if (!file_exists($logfile)) {
$fp = fopen($logfile, "w") or die('ERROR: Can\'t write to the log file ('.$logfile.'), please make sure this file exists and is CHMOD to 666 (rw-rw-rw-)!');
$count = 0;
flock($fp, LOCK_EX);
fputs($fp, $count);
flock($fp, LOCK_UN);
fclose($fp);
chmod($logfile, 0666);
}