PERL   71
summary cgi
Guest on 19th August 2022 04:27:57 PM


  1. #!/usr/bin/perl
  2.  
  3. #  summary.cgi
  4.  
  5. $filearg = "../../counter/data/lutusp_";
  6.  
  7. $outstr = "Content-type: text/HTML\n\n";
  8.  
  9. $outstr .= "<html>\n<head></head>\n<body bgcolor=#ffffff>\n";
  10.  
  11. $outstr .= "<center><font size=+2><b>Summary of Page Hits</b></font><br><br>\n";
  12.  
  13. $outstr .= "<table border=1 cellpadding=3>\n";
  14.  
  15. $outstr .= "<tr><th>Page</th><th>Count</th></tr>\n";
  16.  
  17. foreach $fn (<$filearg*>) {
  18.   $q = $fn;
  19.   $q =~ s/^.*_(.*$)/$1/; # get a title from the filename
  20.   open (DATA,$fn);
  21.   $count = <DATA>;
  22.   close DATA;
  23.   $count =~ s/\n//g;
  24.   $outstr .= "<tr><td>$q</td><td align=right>$count</td></tr>\n";
  25. }
  26.  
  27. $outstr .= "</table>\n</center></body>\n</html>\n";
  28.  
  29. print $outstr;

Raw Paste

Login or Register to edit or fork this paste. It's free.