#!/usr/bin/perl # Update My home page with stats # Feed this procedure with output from hits script # Gerry Patterson, May 2002 $home_html = "/MyHTML/index.html"; while (<>){ @t = split( ' ',$_); ($virus_bum,$virus_hit) = ($t[1],$t[2]) if ($t[0] eq "Virus"); ($robot_bum,$robot_hit) = ($t[1],$t[2]) if ($t[0] eq "Robot"); ($visitor_bum,$visitor_hit) = ($t[1],$t[2]) if ($t[0] eq "Visitor"); } open(HTML,$home_html) || die "Cannot open $home_html\n"; $stats_flag = 0; $visitor_num = $visitor_bum + 1; while (){ $stats_flag++ if (//); if (//){ $stats_flag = 0; next; } if ( $stats_flag == 0 ){ print $_; next; } # replace text between .. print '
You are Visitor Number ' . $visitor_num . ' to this site
| PGTS Site Statistics | ||
|---|---|---|
| Type of Visitor | Number of Visits | Number of Hits |
| MS Worms | ' . $virus_bum . ' | ' . $virus_hit . ' |
| Robots | ' . $robot_bum . ' | ' . $robot_hit . ' |
| Visitors | ' . $visitor_bum . ' | ' . $visitor_hit . ' |