If you can read, but not write, the file, it may be a matter of permissions. Make sure that the web server has permission to write to the file. Also, make sure the file path in your script is still correct after the upload.

Update: A few suggestions:

#!/usr/bin/perl use strict ; # ALWAYS ALWAYS ALWAYS use use warnings ; # strict and warnings! Always! use CGI qw/ :standard / ; # Rather than printing the HTML. my $number_of_digits = 6; open( COUNTING, #"< D:/StronyKlientow/cematsil.bptnet.pl/main/Alicja/perl/counte +r.txt" "< ./counter.txt" # For my testing ) or die "can not open file: $!" ; my $count = <COUNTING>; chomp $count ; # You pretty much always want chomp instead of chop. close (COUNTING); $count++ ; open( COUNTING, # ">D:/StronyKlientow/cematsil.bptnet.pl/main/Alicja/perl/counte +r.txt" ">./counter.txt" # For my testing ) or die "Cannot open: $!\n"; print COUNTING $count ; close COUNTING ; my @digits = split( //, $count ) ; my $spline = '%0' . $number_of_digits . 'd' ; $count = sprintf( "$spline", $count ) ; my $image = '' ; my @digitcount = split( //, $count ) ; foreach my $digitimage (@digitcount) { $image .= img( { 'src' => "../obrazki/$digitimage.gif", 'vspace' => 0 } ) ; } print header, start_html( { 'bgcolor' => 'lightblue' } ) ; print table( { 'align' => 'center', 'border' => 0 }, Tr( td( { 'align' => 'center', 'valign' => 'top' }, $image ) ) ) ; print end_html ; exit;

Update 2: Please read Abigail-II's comments below. [s]?he is, of course, absolutely right; the code I posted does nothing to address the case where two people load your page at the same time.

I've only ever actually made one web counter, a couple years ago in Python, so I didn't really think about all the issues. However: I still say, use strict, use warnings, and take advantage of CGI.

YAU: And yes, merlyn has a WebTechniques column on this.


_______________
D a m n D i r t y A p e
Home Node | Email

In reply to Re: counter by DamnDirtyApe
in thread On server, counter file is read-only by sOKOle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.