Home Menu

Menu



advertisement
Reply
Thread Tools Display Modes
BeRKA
Member
 
BeRKA's Avatar
 
Member Since Aug 2001
Location: Sweden, Stockholm
Posts: 40
22
Default Sep 01, 2001 at 01:44 AM
  #1
I tried the pod logging and I noticed it logged not just searches, but also every click
in the directory (as a search for nothing). I don't know if this was the purpose of the
script, but it wasn't what I wanted.

Suggestion,

change the line:
if (defined($pod_logging)) { &pod_log_search($pod_cgi_search); }

to:
if ((defined($pod_logging)) and (defined($pod_cgi_search))) { &pod_log_search($pod_cgi_search); }

kindly
/BeRKA

BeRKA is offline   Reply With QuoteReply With Quote

advertisement
BeRKA
Member
 
BeRKA's Avatar
 
Member Since Aug 2001
Location: Sweden, Stockholm
Posts: 40
22
Default Sep 01, 2001 at 02:08 AM
  #2
#!/usr/bin/perl

#############################################################################
## Configuration area
##
## Full or relative path to log-file
$pod_logging = "../pod_searches.log";
##
## Number of lines to print
$no_lines = 5;
##
## Number of characters (in each line) to print
$no_char = 25;
#############################################################################

use CGI qw(:all);
print header;
print "<B>Latest Searches:</B><BR>\n";
#
# Total lines
if (-e "$pod_logging")
{
open (CL, "$pod_logging");
while (<CL&gt
{
$totallines++
}
close (CL);
}

# Read file
$startdata = $totallines - $no_lines;
if (-e "$pod_logging")
{
open (TL, "$pod_logging");
for ($count = 0; $count < $totallines; $count += 1)
{
$line = <TL>;
if ($count >= $startdata)
{
chomp $line;
$lastline[$count - $startdata] = $line;
}
}
close (TL);
}

# Cleanup data and print it.
for ($clean = 0; $clean < $no_lines; $clean += 1)
{
$lastline[$clean] = substr($lastline[$clean], 12, $no_char+1);
@lastlinetemp = split(/\&/, $lastline[$clean]);
$lastline[$clean] = $lastlinetemp[0];
if (length($lastline[$clean]) > $no_char)
{
$lastline[$clean] = $lastline[$clean]."...";
}
print $lastline[$clean]."<BR>\n";
}

Comment: There might be some errors that I have not spotted in this since I had to change every
+,>,< to make them visible in this post...
To see this script in action, go to http://www.berka.com/
BeRKA is offline   Reply With QuoteReply With Quote
BeRKA
Member
 
BeRKA's Avatar
 
Member Since Aug 2001
Location: Sweden, Stockholm
Posts: 40
22
Default Sep 08, 2001 at 04:31 AM
  #3
The above code works, but to make it even better You might want to add 2 things.

To remove "plus" which are ugly, and control characters that can mess up the listing,
add this line in the cleanup part of the above code:
$lastlinetemp[0] =~ s/\W/ /g;

To remove other non searches You can add the following line in the pod.cgi in the "pod_log_search"
subroutine to stop it from being logged:
unless (($pod_searchwords eq "0") or ($pod_searchwords =~ "1") or ($pod_searchwords =~ "26") or ($pod_searchwords =~ "76") or ($pod_searchwords =~ "cgi-bin"))


BeRKA is offline   Reply With QuoteReply With Quote
BeRKA
Member
 
BeRKA's Avatar
 
Member Since Aug 2001
Location: Sweden, Stockholm
Posts: 40
22
Default Oct 02, 2001 at 10:46 AM
  #4
Some more non-searches to remove,
and just to see who searches for preteen and lolita, lets log his IP:

unless (($pod_searchwords eq "0") or ($pod_searchwords =~ "1") or ($pod_searchwords =~ "26") or ($pod_searchwords =~ "76") or ($pod_searchwords =~ "cgi-bin") or ($pod_searchwords =~ "^\&") or ($pod_searchwords =~ "^\/"))
{
open (WRITEIT, ">>$pod_logging");
flock(WRITEIT, LOCK_EX);
print WRITEIT "$datej|$pod_searchwords\&$ENV{'REMOTE_ADDR'}\n";
close(WRITEIT);
}



BeRKA is offline   Reply With QuoteReply With Quote
Reply
attentionThis is an old thread. You probably should not post your reply to it, as the original poster is unlikely to see it.



Similar Threads
Thread Thread Starter Forum Replies Last Post
trouble logging in Soveh Community Feedback & Technical Support 1 Jul 28, 2008 11:26 PM
trouble logging in Soveh Other Mental Health Discussion 0 Jul 28, 2008 10:59 PM
Weird Bug On Logging In Anonymous81711 Community Feedback & Technical Support 7 Jun 04, 2008 12:28 AM
logging in Community Feedback & Technical Support 7 Apr 08, 2008 01:03 AM
I'm getting into the site without logging in! (JD) Community Feedback & Technical Support 5 Jun 14, 2004 08:40 PM


All times are GMT -5. The time now is 02:53 PM.
Powered by vBulletin® — Copyright © 2000 - 2024, Jelsoft Enterprises Ltd.



 

My Support Forums

My Support Forums is the online community that was originally begun as the Psych Central Forums in 2001. It now runs as an independent self-help support group community for mental health, personality, and psychological issues and is overseen by a group of dedicated, caring volunteers from around the world.

 

Helplines and Lifelines

The material on this site is for informational purposes only, and is not a substitute for medical advice, diagnosis or treatment provided by a qualified health care provider.

Always consult your doctor or mental health professional before trying anything you read here.