Microsoft
Software
Hardware
Network
Question : cgi equivalent to the php code
Hello Experts,
I have a small php script which actually increment a counter on every hit on the page, becuase it is a php script I cannot include in a .cgi page(perl).
Please can someone help in making a .cgi script equivalent to the below php
$count_my_page = ("hitcounter.txt");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
echo $hits[0];
?>
your help is much appreciated.
thanks
sam
Answer : cgi equivalent to the php code
#!/usr/bin/perl
@ARGV="hitcounter.txt";
$^I=".bak";
while( <> ){
$hits = ++$_;
print;
}
print "Content-Type: text/plain
$hits
";
Random Solutions
flash buttons
Server 2003 Maximum Boot Partition?
Page File Settings: Win2003 running SQL 2005
how do i install rmagick at windows
Error 1324
create a rounded corner, outside white, inside transparent, see atttached for example
Windows XP Warning: "You chose to install Windows XP on a partition that contains another operating system ..."
Get the Collor of an object
Detect if not in frameset
SQL 2005 Mirroring VS SQL 2005 Clustering