ok I have been potring a CGI script to PHP but have run into a small problem. I can't seem to get the script to find my data file even though I used the same code just fine in other scripts.
[PHP]function counter(){
############### ############### ############### ############### #
# Set program parameters here #
############### ############### ############### ############### #
# List of IP addresses to ignore, add your own IP to the list
$ignoreme = array("127.0.0. 2");
# Time (in minutes) to show the user as online after the last request
$keep_online_ti me = 15;
# Time (in minutes) to save the user's IP after the last request. The counter is only increased for unknown IPs.
$keep_in_log_ti me = 60;
# Directory of the counter templates (counter_xxx.ht ml)
$templ_dir = "../counter/";
# Directory of the counter data (log.txt and count.txt)
$data_dir = "../counter/data/";
############### ############### ############### ############### #
# Program starts here #
# GTCounter 1.1 by Wladimir Palant (http://www.gtchat.de/) #
############### ############### ############### ############### #
$current_time = time();
$fp = fopen($data_dir ."log.db", "a") or die("Couldn't open file log.db.");
flock($fp, LOCK_EX);[/PHP]
I just keep getting a file not found unless I remove all path information and have the data file in the root directory. For some reason the file log.db just can't be found.
[PHP]function counter(){
############### ############### ############### ############### #
# Set program parameters here #
############### ############### ############### ############### #
# List of IP addresses to ignore, add your own IP to the list
$ignoreme = array("127.0.0. 2");
# Time (in minutes) to show the user as online after the last request
$keep_online_ti me = 15;
# Time (in minutes) to save the user's IP after the last request. The counter is only increased for unknown IPs.
$keep_in_log_ti me = 60;
# Directory of the counter templates (counter_xxx.ht ml)
$templ_dir = "../counter/";
# Directory of the counter data (log.txt and count.txt)
$data_dir = "../counter/data/";
############### ############### ############### ############### #
# Program starts here #
# GTCounter 1.1 by Wladimir Palant (http://www.gtchat.de/) #
############### ############### ############### ############### #
$current_time = time();
$fp = fopen($data_dir ."log.db", "a") or die("Couldn't open file log.db.");
flock($fp, LOCK_EX);[/PHP]
I just keep getting a file not found unless I remove all path information and have the data file in the root directory. For some reason the file log.db just can't be found.
Comment