Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Visitors logger cgi script

by Anonymous Monk
on Dec 24, 2004 at 15:52 UTC ( #417321=note: print w/replies, xml ) Need Help??


in reply to Re: Visitors logger cgi script
in thread Visitors logger cgi script

Well, first way(image)is acceptable. OK, without referrer. Here is some code I found, but it uses SSI. How to adjust it work with image?
#!/usr/bin/perl # ####################################################### # Visitor Alert Script # # This script notifies you by email whenever your website is visited. # ####################################################### print "Content-type: text/html\n\n"; $sendto = 'you@yourdomain.com'; $mailprgm = '/usr/sbin/sendmail -t'; $page = $ENV{'DOCUMENT_NAME'}; $sitename = $ENV{'SERVER_NAME'}; $client = $ENV{'HTTP_USER_AGENT'}; $camefrom = $ENV{'HTTP_REFERER'}; $addrin = $ENV{'REMOTE_ADDR'}; @ip = split (/\./, $addrin); $binip = pack ("C4", @ip); $isp = gethostbyaddr ($binip, 2); { open (MAIL, "|$mailprgm") || die 'Could not open mail program'; print MAIL "To: $sendto\n"; print MAIL "Subject: Visitor Alert\n"; print MAIL "From: Visitor Alert\n"; print MAIL "\n"; print MAIL "Visitor Alert\n\n"; print MAIL "A visitor from: $isp ($addrin)\n\n"; print MAIL "OS and browser: $client\n\n"; print MAIL "Page name: $page\n\n"; print MAIL "Referrer: $camefrom\n\n"; print MAIL "Page visited: $sitename\n\n"; close (MAIL); } exit;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://417321]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (10)
As of 2023-12-11 19:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (41 votes). Check out past polls.

    Notices?