40 users online (0 members and 40 guests)  

Thread: counter program


  Results 1 to 2 of 2

Related

  1. Help with a small counter    Forum: Javascript Forum
    Replies: 2
  2. looking for a counter    Forum: Website Scripts Forum
    Replies: 3
  3. looking for a counter    Forum: Introduce Yourself
    Replies: 1
  4. Counter!!!!!    Forum: Website Scripts Forum
    Replies: 3
  5. hit counter    Forum: HTML Forum
    Replies: 5
  1. #1
    abhi_86's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2007
    Posts
    1

    counter program

    hi i am trying to create a perl script which tells us the number of times the pagre was acesses.

    but it doesnt work properly

    here is the perl script . please tell me what's wrong with it .................
    Code:
    #!/usr/bin/perl -w 
    print "content-type: text/html\n\n"; 
    print "<html><body>"; 
    my $cnt_file = "count.txt"; 
    my $num_access; 
    open (FILE, "< $cnt_file"); 
    $num_access = <FILE>; 
    close(FILE); 
    open (FILE, "> $cnt_file"); 
    $num_access++; 
    print FILE $num_access; 
    close (FILE); 
    print "<H1>Page Visited $num_access times</H1>"; 
    print "</body></html>";

    i even enable the write permission for the txt file.
    but still it looks like the script never ends up updating the value of num_access in the file.

  2. #2
    SoftNet-WD's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2007
    Posts
    2

    Re: counter program

    you need to make sure that count.text is already created and premissions are set to 755.



Tags for this Thread