:))) thanks rdfield I can read the file now, BUT I CAN NOT WRITE TO IT. Full code below, it is the simplest CGI counter:
#!/usr/bin/perl
$number_of_digits = "6";
######################
open (COUNTING, "< D:/StronyKlientow/cematsil.bptnet.pl/main/Alicja/pe
+rl/counter.txt")||die"can not open";
$count = <COUNTING>;
close (COUNTING);
$count ++;
print ("Content-type: text/html\n\n");
print "<HTML><BODY BGCOLOR=lightblue><TABLE ALIGN=center BORDER=0>\n\n
+";
print "<TR><TD ALIGN=Center VALIGN=top>\n\n";
@digits = split(//, $count);
# Give empty digits a value
$spline = '%0' . $number_of_digits . 'd';
$count = sprintf("$spline", $count);
@digitimages = split(//, $count);
foreach $digitimage (@digitimages) {
$image = "<img src=\"../obrazki/" . "$digitimage" . ".gif\" VSPACE=0>
+";
print ("$image");
}
print "\n";
print "</TD></TR></TABLE>\n</BODY></HTML>\n\n";
open (COUNTER, "> D:/StronyKlientow/cematsil.bptnet.pl/main/Alicja/per
+l/counter.txt")||die"can not open!\n";
print COUNTER ("$count");
close (COUNTER);
exit;
whatever I do the counter do not increse. What should I do now?
Thank you in advance, Regards, sOKOle
Edit by tye | [reply] [d/l] |
Eek...please use <code> tags. To write to the file, you'll need to remove the < from before the "D:" - as it stands the code only opens the file for reading. You might want to have a look through perlfaq5.rdfield
| [reply] |
open (COUNTER, "D:/StronyKlientow/cematsil.bptnet.pl/main/Alicja/perl
+/counter.txt")||die"can not open!\n";
print COUNTER ("$count");
close (COUNTER);
but it doesn't help. My suppose is that the administrator should open the possibility ... somehow...he uses Apache server.
Please comment.
I appreciete help, rgds rdfield
Edit by tye | [reply] [d/l] |
I should give the code more properly, here it is:
#!/usr/bin/perl
$number_of_digits = "6";
open (COUNTING, "< D:/StronyKlientow/cematsil.bptnet.pl/main/Alicja/pe
+rl/counter.txt")||die"can not open";
$count = <COUNTING>;
close (COUNTING);
$count ++;
print ("Content-type: text/html\n\n");
print "<HTML><BODY BGCOLOR=lightblue><TABLE <BR>ALIGN=center BORDER=0>
+\n\n";
print "<TR><TD ALIGN=Left VALIGN=top>\n\n";
@digits = split(//, $count);
$spline = '%0' . $number_of_digits . 'd';
$count = sprintf("$spline", $count);
@digitimages = split(//, $count);
foreach $digitimage (@digitimages) {
$image = "<img <BR>src=\"../obrazki/" . "$digitimage" . ".gif\" VSPAC
+E=0>";
print ("$image");}
print "\n";
open (COUNTER, "> D:/StronyKlientow/cematsil.bptnet.pl/main/Alicja/per
+l/counter.txt")||die"can not open!\n";
print COUNTER ("$count");
close (COUNTER);
print "</end of HTML TAGS \n</BODY></HTML>\n\n";
exit;
Edit by tye.
| [reply] [d/l] [select] |
| [reply] [d/l] [select] |