ASIC/FPGA Design and Verification Out Source Services
Simple WEB entry counter using PERL cgi
- Create your HTML file.
- Once you are happy with the result, convert it into PERL.
Add the following to the top of youur new file:
#!/usr/bin/perl -w
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use strict;
use Socket;
print header;
print start_html("Remote Host");
On each existing line, add the following suffix and prefix:
print "
...your original line...
";
make sure each special character (like ") is escaped by \.
At the end put
print end_html;
Before ending with end_html is where our counter comes in.
my $ent_cnt="";
if(-e "/home/.../CV_1_count.txt") {
open(FPR, "/home/lxuser/pini/pini_share/jjj/WEB/CV_1_count.txt");
$ent_cnt=<FPR>;
chomp($ent_cnt);
close(FPR);
} else { $ent_cnt=0; }
$ent_cnt++;
open(FPW, ">/home/.../CV_1_count.txt");
print FPW ("$ent_cnt");
close(FPW);
print "This page has been visited $ent";
Contact me now at: |