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
VSFlexGrid 7
Setting reply-to using SMTP over telnet
Number Format?
Macro freezes Excel. Desperate!
Certain emails are showing up blank on Blackberries
meta refresh?!
How to write a shell script to untar files?
How to read a sharepoint list and write to another list via Powershell?
Files gone missing and only shortcuts appear
Sendmail mailhost not resolved