Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

PWS::Report

by Steeeeeve (Initiate)
on Feb 03, 2001 at 07:40 UTC ( [id://56196]=sourcecode: print w/replies, xml ) Need Help??
Category: Utilities
Author/Contact Info Steeeeeve greentv@paulbunyan.net
Description: Reports via email when someone has accessed your PWS or any script in particular running on the PWS that calls this script. I configure it to work with my PWS site wrapper. I plan to gather as much information as possible about who accesses my PWS. It logs the user_id so that I will be able to see later what pages they accessed. More will be added as it is learned. -Steeeeeve
#PWS notifier/logger
# Report.pm
# C. Prichard
# 2-2-01

package Report;

$ReportPackage = "PWS::Report";
$ReportPackage::Version = "000514";
$::Report = $ReportPackage;

sub new(){

    my $class = shift;
    
    bless $self{};
    
    $self->init();

    $self;
}
sub init(){
    
    use Lady::Lady_DATE;

    $self{'TIME'} = new Lady_DATE;

    $LADY_TABLE{'_time'} = $self{'TIME'}->lady_time;
    
    $self{'smtp'} = "mail.somewhere.net";
    $self{'admin_email'} = 'myname@mail.somewhere.net';
    $self{'smtp_username'} = 'user';

    $self{'header'} = " $ENV{'REMOTE_ADDR'}";
        $self{'message'} = "$LADY_TABLE{'_time'}\n\nRemote ADDR:$ENV{'
+REMOTE_ADDR'}\n\nRemote HOST:$ENV{'REMOTE_HOST'}\n\nHTTP_REFERER:$ENV
+{'HTTP_REFERER'}\n\nUSER AGENT:$ENV{'HTTP_USER_AGENT'}\n\nBYE.\n\n-PW
+S\n";

    return;
    
}
    
sub report(){
    
    my $class = shift;

    use Net::SMTP;
    
    $smtp = Net::SMTP->new( $self{'smtp'},
                            Hello => $self{'smtp'},
                            Timeout => 30,
                            Debug   => 1); 

    # print "DOMAIN:".$smtp->domain."<br>\n"; 

    $smtp->quit; 
    
        $smtp = Net::SMTP->new($self{'smtp'});
    
        $smtp->mail($ENV{USER});
        $smtp->to($self{'admin_email'});
           $smtp->data();
        $smtp->datasend("To: $self{'smtp_username'}\n");
        $smtp->datasend("From: PWS \n");
        $smtp->datasend("Subject: PWS accessed from:$self{'header'}\n"
+);
        $smtp->datasend("START::\n");
        $smtp->datasend("\n\nHello:\n\n");
        $smtp->datasend("$self{'message'}\n");
        # $smtp->datasend("::END\n");
        $smtp->dataend();
    
        $smtp->quit;
 
 return;       
}

1;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (8)
As of 2024-04-18 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found