Track the number of times a web page has been accessed : Page « CGI « Perl






Track the number of times a web page has been accessed

    

#!perl

use CGI qw( :standard );
open( COUNTREAD, "counter.dat" );
   $data = <COUNTREAD>;
   $data++;
close( COUNTREAD );

open( COUNTWRITE, ">counter.dat" );
   print COUNTWRITE $data;
close( COUNTWRITE );

print header;
print "<CENTER>";
print "<STRONG>You are visitor number</STRONG><BR>";

for ( $count = 0; $count < length( $data ); $count++ )
{
   $number = substr( $data, $count, 1 );
   print "<IMG SRC = \"images/counter/$number.jpg\">";
}

print "</CENTER>";

   
    
    
    
  








Related examples in the same category

1.Redirect a web page
2.Redirect page
3.Values Carried Between Pages
4.Page counter
5.Logs visitors to web site
6.Server push