I use simple script that keeps a log of everyone who "hits" the page, keeping the information in one file. For some reason, it produce unformatted log, without spaces and paragrafs, which is very difficult to browse:
Time: 05/13/05 08:09:12 EDT User: Host: Addr: 22.85.112.194 With: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Page: From: Time: 05/13/05 08:09:18 EDT User: Host: Addr: 22.85.112.194 With: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Page: From: Time: 05/13/05 08:09:28 EDT User: Host: Addr: 22.85.112.194 With: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Page: From: Time: 05/13/05 08:09:31 EDT User: Host: Addr: 22.85.112.194 With: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Page: From:
How to make text separated a little, like this:
Date: Fri May 13 04:00:08 2005
Page Visited: http://www.appt.org.uk/technical/calc_and_convert.htm
Host Name:
Visitor IP: 65.117.182.58
Browser: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1
Date: Fri May 13 04:00:44 2005
Page Visited: http://www.appt.org.uk/technical/size_chart.htm
Host Name:
Visitor IP: 65.117.182.58
Browser: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1
#!/usr/bin/perl
# logger.cgi
# version 1.0
# Create a file called main.log. Must have write permissions
# set to main.log
$mainlog = '/path/to/file/stats.txt';
$shortdate = `date +"%D %T %Z"`;
chop ($shortdate);
print "Content-type: text/plain\n\n ";
open (MAINLOG, ">>$mainlog");
print MAINLOG "Time: $shortdate\n";
print MAINLOG "User: $ENV{'REMOTE_IDENT'}\n";
print MAINLOG "Host: $ENV{'REMOTE_HOST'}\n";
print MAINLOG "Addr: $ENV{'REMOTE_ADDR'}\n";
print MAINLOG "With: $ENV{'HTTP_USER_AGENT'}\n";
print MAINLOG "Page: $ENV{'DOCUMENT_URI'}\n";
print MAINLOG "From: $ENV{'HTTP_REFERER'}\n\n";
close (MAINLOG);
exit;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.