Hi Eliot, The following script works now... Works under NT without SSI...
Save this into 15visitors.pl
#!/usr/local/bin/perl
# 15visitors
# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \
require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}
# ========================================================
use Net::hostent;
use Socket;
$ip = $ENV{'REMOTE_ADDR'};{
&log_search;
}
# The variable "$ENV{'REMOTE_ADDR'}" contains the IP address of the person calling the script.
$h = gethost($ip);
$name = $h->name;
$name =~ s/\/D/\//g;
$name =~ s/\/F/\//g;
$name = lc($name);
$name =~ s/[^-_.a-z0-9]+//g;
# We just tried to resolve the IP into a name, in the next line we check if we didn't mange to get a name,
# in which case, we set the $name variable to be the same as the IP.
if ($name eq "") { $name = $ip; }
chomp $name;
$iporig = $ip;
$count= "C:/inetpub/wwwroot/pages/counter.txt"; # path to counter file
$recent = "C:/inetpub/wwwroot/pages/hits.txt"; # path to recent hits file
$kword_file1 = "C:/inetpub/wwwroot/pages/keywords1.txt";
if ($ip eq "212.238.90.190") { $ip = "<b><a href=http://www.winwin.demon.nl target=_blank><b><font color=blue>\@<font color=lightblue>wiN</b></font></font></a></b>"; }
if ($ip eq "195.66.30.215") { $ip = "<b><a href=http://195.66.30.215/ target=_blank><b><font color=blue>\<font color=lightblue>AstaLaPista</b></font></font></a></b>"; }
if ($ip eq "193.132.124.53") { $ip = "<b><A href=http://www.gwawr.co.uk/ target=_blank><b><font color=cadetblue>Gwawr</b></font></a>"; }
if ($ip eq "212.238.76.194") { $ip = "<b><a href=http://www.pschmitz.demon.nl target=_blank>Law Enforcer</a></b>"; }
if ($ip eq "194.222.211.238") { $ip = "<b><a href=http://www.segapod.demon.co.uk target=_blank>Asam_B</a></b>"; }
# A couple of people i know have static IP addresses, ths means my script can recognise them straight
# away and change the $ip variable so that it contains a link to their respective site.
if ($ip eq $iporig) {
# the above line checks that I haven't already changed the $ip variable in the section below, if I haven't
# then we read the users cookies, if the user is an active participant on the webboards, then they'll have a
# cookie set with their name in it
local(@rawCookies) = split (/; /,$ENV{'HTTP_COOKIE'});
local(%cookies);
foreach(@rawCookies){
($key, $val) = split (/=/,$_);
$cookies{$key} = $val;
}
$who = $cookies{name};
# OK, so if they had a cookie, we now have it in $who, it'll be encoded, so the following line decodes it.
$who =~ s/%(..)/chr(hex($1))/ge; #decode ASCII hexadecimal values into characters
# It's possible that the user could have edited their cookie and put HTML tags in it, as we are going to
# display the cookie value to the screen, this could be potentialy dangerous, so now we replace < & > with
# the relevant HTML symbol.
$who =~ s/</</g;
$who =~ s/>/>/g;
# If $who is not empty (it'd be empty if there was no cookie available), then change the $ip variable to
# contain the cookie value
if ($who ne "") {$ip = $who;}
# This bit is similar to a section above, basically a few lucky devils automatically get their name colored in
# and hyperlinked.
if ($who eq "Dr OwL") {$ip = "<b><a href=http://www.fly.to/eris23 target=hoot><font color=Blue>D</font><font color=blue>r</font><font color=Yellow>.Ow</font><font color=red>L</font></a></b>";}
if ($who eq "AstaLaPista") {$ip = "<b><a href=http://195.66.30.215 target=hoot><font color=Blue>D</font><font color=blue>r</font><font color=Yellow>.AstaLaPista</font><font color=red>L</font></a></b>";}
if ($who eq "Veg") {$ip = "<b><a href=http://pages.nyu.edu/~scs216 target=_blank><font color=9966ff>Veg</font></a></b>";}
if ($who eq "tress") {$ip = "<b><a href=http://tress.virtualave.net target=_blank>tress</a></b>";}
if ($who eq "Lathem") {$ip = "<b><a href=http://lathem.cjb.net/ target=_blank>Lathem</a></b>";}
if ($who eq "win") {$ip = '<b><a href=http://www.winwin.demon.nl target=_blank><font color=blue>@<font color=lightblue>wiN</font></font></font></a></b>'; $name = "www.nsa.gov";}
if ($who eq "lolli") {$ip = '<b><a href=http://home.tampabay.rr.com/twothree target=_blank><font color=8000ff>23</font></font></a></b>';}
if ($who eq "cypress hill") {$ip = "<b><a href=http://www.the-lamer.com target=_blank>cypress hill</a></b>";}
if ($who eq "salsa") {$ip = '<b><a href=http://altern.org/lizz/ target=_blank><font color=cc99ff>salsa</font></a></b>';}
}
# I didnt think it was a good idea to show everyones IP & hostname, so here we chop off the first bit of the
# hostname, ie:
# tide67.microsoft.com would become microsoft.com. If the user didn't have a cookie set, then their IP will
# show anyway. More initiative to get involved ont he webboards i guess : )
$xx = index($name,".");
if ($xx ne "-1") {
$name = substr($name, $xx + 1, 100);
}
$ip = "$ip";
# Now we have the complete string we want to add to the recent visitors list.
$string = "$name [$ip]";
open(COUNT,"+<$count") | | die "Couldn't open file: $count: $! \n";
$hits = <COUNT>;
# So now we have opened the counter file, $hits now contains the amount of hits we have had so far
open(RECENT,"+<$recent") | | die "Couldn't open file: $recent: $! \n";
@recentArray = <RECENT>;
seek RECENT, 0, 0;
# We've now opened and gone to the top of the Recent hits file, so lets print the new user ($string) and
# write back the other 14 we want to keep
print RECENT "$string\n @recentArray[0] @recentArray[1] @recentArray[2] @recentArray[3]";
print RECENT "@recentArray[4] @recentArray[5] @recentArray[6] @recentArray[7] @recentArray[8]";
print RECENT "@recentArray[9] @recentArray[10] @recentArray[11] @recentArray[12]
@recentArray[13]";
truncate RECENT, tell RECENT;
close RECENT;
open(RECENT,"+<$recent") | | die "Couldn't open file: $recent: $! \n";
@recentArray = <RECENT>;
close RECENT;
# here we bump up the hit counter by one and save it.
$hits = $hits + 1;
seek (COUNT,0,0);
@newcount = $hits;
print COUNT @newcount;
close COUNT;
#print("Content-type: text/html\n\n");
# Here we print the output to the browser, because I am using it in an SSI, i commented out the above line.
# If you are not useing SSI, you'd need to remove the comment to re-enable the header.
print("
<html>
<head>
<title>AstaLaPista Last 15 Visitors</title>
</head>
<center><table width=\"85%\" border=\"0\" cellspacing=0 cellpadding=0>
<tr>
<td nowrap nowrap align=\"left\" valign=\"top\" width=\"100%\" colspan=\"2\"><div align=\"left\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b>AstaLaPista Last 15 Visitors</b></font></div>
</td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">01)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[0]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">02)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[1]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">03)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[2]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">04)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[3]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">05)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[4]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">06)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[5]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">07)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[6]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">08)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[7]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">09)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[8]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">10)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[9]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font color=\"#330099\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"1\">11)</font></b></font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[10]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font color=\"#330099\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"1\">12)</font></b></font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[11]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font color=\"#330099\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"1\">13)</font></b></font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[12]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font color=\"#330099\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"1\">14)</font></b></font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[13]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font color=\"#330099\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"1\">15)</font></b></font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[14]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font color=\"#330099\"></a></font></b></font></div>
</td>
</tr>
</table></center>");
print ("
</font>
</body>
</html>
");
sub log_search {
my $curr_time = time;
my $term = lc($ip);
if (-e "$kword_file1") {
$file_size = (-s "$kword_file1");
if ($file_size > 1000000) {
open (DAT, ">$kword_file1") or &cgierr ("Error [search.pl]: Unable to create search log file. Reason: $!");
flock (DAT, 2) or &cgierr ("Error [search.pl]: Unable to flock search log file. Reason: $!");
print DAT "$term|1|$curr_time\n";
close (DAT);
}
else {
open (DAT, "<$kword_file1") or &cgierr ("Error [search.pl]: Unable to open search log file. Reason: $!");
@kwords = <DAT>;
close (DAT);
$newfile = "";
$found = 0;
foreach $line (@kwords) {
chomp $line;
($word, $count, $oldtime) = split (/\|/,$line);
if ($term eq lc($word)) {
$count++;
$found++;
$newline = "$word|$count|$curr_time\n";
$newfile .= $newline;
}
else { $newfile .= "$line\n"; }
}
if (! $found) {
$newline = "$term|1|$curr_time\n";
$newfile .= $newline;
}
open (DAT, ">$kword_file1") or &cgierr ("Error [search.pl]: Unable to open search log file. Reason: $!");
flock (DAT, 2) or &cgierr ("Error [search.pl]: Unable to flock search log file. Reason: $!");
print DAT $newfile;
close (DAT);
}
}
else {
open (DAT, ">$kword_file1") or &cgierr ("Error [search.pl]: Unable to create search log file. Reason: $!");
flock (DAT, 2) or &cgierr ("Error [search.pl]: Unable to flock search log file. Reason: $!");
print DAT "$name|1|$curr_time\n";
close (DAT);
chmod (0666, "$kword_file1") or &cgierr ("Error [search.pl]: Cannot chmod search log file. Reason: $!");
}
}
After that follow the instructions at:
http://www.codes-central.com/WebAdverts-Links.shtml and it worked, yeaaahhhh.
Put it into you home.html. This script shows the last 15 visitors by IP or DNS name on their browserscreen. All the visitors IP will be logged. With keylog viewer you can read the log file and you will see how many time an IP has visit your site... thats all and it looks nice...
[This message has been edited by Hacktor (edited May 12, 2000).]
[This message has been edited by Hacktor (edited May 12, 2000).]
Save this into 15visitors.pl
#!/usr/local/bin/perl
# 15visitors
# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \
require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}
# ========================================================
use Net::hostent;
use Socket;
$ip = $ENV{'REMOTE_ADDR'};{
&log_search;
}
# The variable "$ENV{'REMOTE_ADDR'}" contains the IP address of the person calling the script.
$h = gethost($ip);
$name = $h->name;
$name =~ s/\/D/\//g;
$name =~ s/\/F/\//g;
$name = lc($name);
$name =~ s/[^-_.a-z0-9]+//g;
# We just tried to resolve the IP into a name, in the next line we check if we didn't mange to get a name,
# in which case, we set the $name variable to be the same as the IP.
if ($name eq "") { $name = $ip; }
chomp $name;
$iporig = $ip;
$count= "C:/inetpub/wwwroot/pages/counter.txt"; # path to counter file
$recent = "C:/inetpub/wwwroot/pages/hits.txt"; # path to recent hits file
$kword_file1 = "C:/inetpub/wwwroot/pages/keywords1.txt";
if ($ip eq "212.238.90.190") { $ip = "<b><a href=http://www.winwin.demon.nl target=_blank><b><font color=blue>\@<font color=lightblue>wiN</b></font></font></a></b>"; }
if ($ip eq "195.66.30.215") { $ip = "<b><a href=http://195.66.30.215/ target=_blank><b><font color=blue>\<font color=lightblue>AstaLaPista</b></font></font></a></b>"; }
if ($ip eq "193.132.124.53") { $ip = "<b><A href=http://www.gwawr.co.uk/ target=_blank><b><font color=cadetblue>Gwawr</b></font></a>"; }
if ($ip eq "212.238.76.194") { $ip = "<b><a href=http://www.pschmitz.demon.nl target=_blank>Law Enforcer</a></b>"; }
if ($ip eq "194.222.211.238") { $ip = "<b><a href=http://www.segapod.demon.co.uk target=_blank>Asam_B</a></b>"; }
# A couple of people i know have static IP addresses, ths means my script can recognise them straight
# away and change the $ip variable so that it contains a link to their respective site.
if ($ip eq $iporig) {
# the above line checks that I haven't already changed the $ip variable in the section below, if I haven't
# then we read the users cookies, if the user is an active participant on the webboards, then they'll have a
# cookie set with their name in it
local(@rawCookies) = split (/; /,$ENV{'HTTP_COOKIE'});
local(%cookies);
foreach(@rawCookies){
($key, $val) = split (/=/,$_);
$cookies{$key} = $val;
}
$who = $cookies{name};
# OK, so if they had a cookie, we now have it in $who, it'll be encoded, so the following line decodes it.
$who =~ s/%(..)/chr(hex($1))/ge; #decode ASCII hexadecimal values into characters
# It's possible that the user could have edited their cookie and put HTML tags in it, as we are going to
# display the cookie value to the screen, this could be potentialy dangerous, so now we replace < & > with
# the relevant HTML symbol.
$who =~ s/</</g;
$who =~ s/>/>/g;
# If $who is not empty (it'd be empty if there was no cookie available), then change the $ip variable to
# contain the cookie value
if ($who ne "") {$ip = $who;}
# This bit is similar to a section above, basically a few lucky devils automatically get their name colored in
# and hyperlinked.
if ($who eq "Dr OwL") {$ip = "<b><a href=http://www.fly.to/eris23 target=hoot><font color=Blue>D</font><font color=blue>r</font><font color=Yellow>.Ow</font><font color=red>L</font></a></b>";}
if ($who eq "AstaLaPista") {$ip = "<b><a href=http://195.66.30.215 target=hoot><font color=Blue>D</font><font color=blue>r</font><font color=Yellow>.AstaLaPista</font><font color=red>L</font></a></b>";}
if ($who eq "Veg") {$ip = "<b><a href=http://pages.nyu.edu/~scs216 target=_blank><font color=9966ff>Veg</font></a></b>";}
if ($who eq "tress") {$ip = "<b><a href=http://tress.virtualave.net target=_blank>tress</a></b>";}
if ($who eq "Lathem") {$ip = "<b><a href=http://lathem.cjb.net/ target=_blank>Lathem</a></b>";}
if ($who eq "win") {$ip = '<b><a href=http://www.winwin.demon.nl target=_blank><font color=blue>@<font color=lightblue>wiN</font></font></font></a></b>'; $name = "www.nsa.gov";}
if ($who eq "lolli") {$ip = '<b><a href=http://home.tampabay.rr.com/twothree target=_blank><font color=8000ff>23</font></font></a></b>';}
if ($who eq "cypress hill") {$ip = "<b><a href=http://www.the-lamer.com target=_blank>cypress hill</a></b>";}
if ($who eq "salsa") {$ip = '<b><a href=http://altern.org/lizz/ target=_blank><font color=cc99ff>salsa</font></a></b>';}
}
# I didnt think it was a good idea to show everyones IP & hostname, so here we chop off the first bit of the
# hostname, ie:
# tide67.microsoft.com would become microsoft.com. If the user didn't have a cookie set, then their IP will
# show anyway. More initiative to get involved ont he webboards i guess : )
$xx = index($name,".");
if ($xx ne "-1") {
$name = substr($name, $xx + 1, 100);
}
$ip = "$ip";
# Now we have the complete string we want to add to the recent visitors list.
$string = "$name [$ip]";
open(COUNT,"+<$count") | | die "Couldn't open file: $count: $! \n";
$hits = <COUNT>;
# So now we have opened the counter file, $hits now contains the amount of hits we have had so far
open(RECENT,"+<$recent") | | die "Couldn't open file: $recent: $! \n";
@recentArray = <RECENT>;
seek RECENT, 0, 0;
# We've now opened and gone to the top of the Recent hits file, so lets print the new user ($string) and
# write back the other 14 we want to keep
print RECENT "$string\n @recentArray[0] @recentArray[1] @recentArray[2] @recentArray[3]";
print RECENT "@recentArray[4] @recentArray[5] @recentArray[6] @recentArray[7] @recentArray[8]";
print RECENT "@recentArray[9] @recentArray[10] @recentArray[11] @recentArray[12]
@recentArray[13]";
truncate RECENT, tell RECENT;
close RECENT;
open(RECENT,"+<$recent") | | die "Couldn't open file: $recent: $! \n";
@recentArray = <RECENT>;
close RECENT;
# here we bump up the hit counter by one and save it.
$hits = $hits + 1;
seek (COUNT,0,0);
@newcount = $hits;
print COUNT @newcount;
close COUNT;
#print("Content-type: text/html\n\n");
# Here we print the output to the browser, because I am using it in an SSI, i commented out the above line.
# If you are not useing SSI, you'd need to remove the comment to re-enable the header.
print("
<html>
<head>
<title>AstaLaPista Last 15 Visitors</title>
</head>
<center><table width=\"85%\" border=\"0\" cellspacing=0 cellpadding=0>
<tr>
<td nowrap nowrap align=\"left\" valign=\"top\" width=\"100%\" colspan=\"2\"><div align=\"left\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><b>AstaLaPista Last 15 Visitors</b></font></div>
</td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">01)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[0]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">02)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[1]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">03)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[2]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">04)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[3]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">05)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[4]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">06)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[5]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">07)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[6]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">08)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[7]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">09)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[8]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font face=\"Arial, Helvetica, sans-serif\" size=\"1\" color=\"#330099\">10)</font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[9]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font color=\"#330099\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"1\">11)</font></b></font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[10]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font color=\"#330099\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"1\">12)</font></b></font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[11]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font color=\"#330099\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"1\">13)</font></b></font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[12]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font color=\"#330099\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"1\">14)</font></b></font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[13]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font color=\"#330099\"><b><font face=\"Arial, Helvetica, sans-serif\" size=\"1\">15)</font></b></font></td>
<td nowrap align=\"left\" valign=\"top\" width=\"96%\"><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\">@recentArray[14]</font></td>
</tr>
<tr>
<td nowrap align=\"left\" valign=\"top\" width=\"4%\"><font color=\"#330099\"></a></font></b></font></div>
</td>
</tr>
</table></center>");
print ("
</font>
</body>
</html>
");
sub log_search {
my $curr_time = time;
my $term = lc($ip);
if (-e "$kword_file1") {
$file_size = (-s "$kword_file1");
if ($file_size > 1000000) {
open (DAT, ">$kword_file1") or &cgierr ("Error [search.pl]: Unable to create search log file. Reason: $!");
flock (DAT, 2) or &cgierr ("Error [search.pl]: Unable to flock search log file. Reason: $!");
print DAT "$term|1|$curr_time\n";
close (DAT);
}
else {
open (DAT, "<$kword_file1") or &cgierr ("Error [search.pl]: Unable to open search log file. Reason: $!");
@kwords = <DAT>;
close (DAT);
$newfile = "";
$found = 0;
foreach $line (@kwords) {
chomp $line;
($word, $count, $oldtime) = split (/\|/,$line);
if ($term eq lc($word)) {
$count++;
$found++;
$newline = "$word|$count|$curr_time\n";
$newfile .= $newline;
}
else { $newfile .= "$line\n"; }
}
if (! $found) {
$newline = "$term|1|$curr_time\n";
$newfile .= $newline;
}
open (DAT, ">$kword_file1") or &cgierr ("Error [search.pl]: Unable to open search log file. Reason: $!");
flock (DAT, 2) or &cgierr ("Error [search.pl]: Unable to flock search log file. Reason: $!");
print DAT $newfile;
close (DAT);
}
}
else {
open (DAT, ">$kword_file1") or &cgierr ("Error [search.pl]: Unable to create search log file. Reason: $!");
flock (DAT, 2) or &cgierr ("Error [search.pl]: Unable to flock search log file. Reason: $!");
print DAT "$name|1|$curr_time\n";
close (DAT);
chmod (0666, "$kword_file1") or &cgierr ("Error [search.pl]: Cannot chmod search log file. Reason: $!");
}
}
After that follow the instructions at:
http://www.codes-central.com/WebAdverts-Links.shtml and it worked, yeaaahhhh.
Put it into you home.html. This script shows the last 15 visitors by IP or DNS name on their browserscreen. All the visitors IP will be logged. With keylog viewer you can read the log file and you will see how many time an IP has visit your site... thats all and it looks nice...
[This message has been edited by Hacktor (edited May 12, 2000).]
[This message has been edited by Hacktor (edited May 12, 2000).]