/*************************************
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);
}
GraphCount - automatic log file creation
This was included in counter version 1.0 but I decided to remove it in 1.1 as it could lead to potential security issues.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Hi Klemen,
Thanks for your reply. Hopefully I won't experience any security problems with this modification as none of the directories or sub-directories for the Graphic Counter are world writable.
My main reasons for adding this code were:
1. so that the webmaster (usually me but sometimes another person) does not have to remember to create the log file when a new page is created; and
2. as a way of zeroing the counters (be deleting the log files on the server).
Kathy
Thanks for your reply. Hopefully I won't experience any security problems with this modification as none of the directories or sub-directories for the Graphic Counter are world writable.
My main reasons for adding this code were:
1. so that the webmaster (usually me but sometimes another person) does not have to remember to create the log file when a new page is created; and
2. as a way of zeroing the counters (be deleting the log files on the server).
Kathy
Anyway, forgot to say thanks for sharing 

Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools