![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
To access the contents, click the chapter and section titles.
Perl CGl Programming: No experience required.
Then, set up the header and titles for an HTML document in the program just after reading all of the files in the log directory into the list: # Get the list of log files into an array. @LogFiles = readdir (LOGD); # Crank up a Web page. HTML_Header ($Title); print "<BODY>\n"; print "<H1 ALIGN=\"CENTER\">$Title</H1>\n"; print "<HR>\n"; Last, the portion of the script that prints the data needs a near-total rewrite: i f ($LogFile =~ /(..)(..)(..)(..)/) { $year = $2; $month = $3; $day = $4; } print "<H3>Date: $month/$day/$year:</H3>\n<HR>\n"; print "<TABLE WIDTH=50%>\n"; for ($n = 0; $n < $HitCount; $n++) { print "<TR>\n<TD>$IPHits[$n]</TD> <TD>$NumHits[$n] accesses</TD>\n"; print "</TR>\n"; } print "</TABLE>\n<HR>\n"; Notice that the print statements format the data in HTML tables. They look better that way. Make these changes, then save the file as webhit.pl in a directory accessible to your Web server through CGI. Then invoke it as a URL from your Web browser. Youll see something similar to what is illustrated in Figure 9.9.
Congratulations! Youve moved your hit counter to the World Wide Web.
Moving On Youve undertaken a lot in this skill. You have built, from the ground up, the capability to analyze your Web server logs in a simple fashion. You have built a foundation for a full statistical analysis of your Web site. In Skill 10, you will learn about HTML in detail: how it was derived from the Standard Generalized Markup language, some examples of full-blown SGML, and how the parent led to the child as the lingua franca of the World Wide Web. Youll also learn how modern-day HTML interacts with the Web. Are You Experienced?Now you can
|
![]() |
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. |