tame1 has asked for the wisdom of the Perl Monks concerning the following question:
package Apache::TaartsLog; use CGI qw(:cgi); use Apache (); use Apache::Constants qw(:common &OPT_EXECCGI &REDIRECT); use DBI; my $query = new CGI(); $dbh = DBI->connect("dbi:mysql:taarts","jrobiso2","") || die "$DBI::er +rstr: $!\n"; sub handler { my $r = shift; # @_[0] contains a reference to # the current request handler my ($request); my ($hostname); # Returns a blessed reference if ($r->main) { # unless this is the main request $orig = $r->main; } else { $orig = $r; } $hostname = $orig->get_remote_host; $request = $orig->filename; $user = $query->remote_user(); # this apparently fails. unless (($request =~ /jpg/) || ($request =~ /gif/)) { $dbh->do("insert into logs (host,request,time_stamp,cdsid) +VALUES ('$hostname','$request',NOW(),'$user')"); } } END { undef($dbh); } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Apache Modules
by larryl (Monk) on Mar 13, 2001 at 00:32 UTC | |
by tame1 (Pilgrim) on Mar 13, 2001 at 00:42 UTC | |
by larryl (Monk) on Mar 13, 2001 at 00:51 UTC | |
by tame1 (Pilgrim) on Mar 13, 2001 at 01:02 UTC | |
by btrott (Parson) on Mar 13, 2001 at 00:43 UTC | |
|
Re: Apache Modules
by larryl (Monk) on Mar 13, 2001 at 00:21 UTC | |
|
Re: Apache Modules
by LunaticLeo (Scribe) on Mar 14, 2001 at 01:40 UTC |