PHP Dazed and confused!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Vagabond
    New Member
    • Apr 2006
    • 17

    #1

    PHP Dazed and confused!

    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.
    Last edited by Vagabond; May 18 '06, 07:58 PM.
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    The code doesn't look wrong unless you have got the wrong capitalisation on counter or data or unless you have the attributes of ../counter/data set wrong so that you can not open a writable file.

    Comment

    Working...