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
Access Denyed with Squid
Macrovision Setup will not run proprly
XP Pro reinstall - NTFS Format Crawling. Why???
A program or firewall is not compatible with Windows Vista - wscript.exe
Wanted to open a new word document through OLE
Attach DB from storage drive
powershell Get-Acl to Set-Acl system date variable and output to file
8 GB DDR2 PC-5300 RAM installed, shows up in BIOS, but in not in XP
after removing rogue anti-spyware av2009 Internet Explorer will not connect
F8 Produces a blue screen with gears as the picture