summaryrefslogtreecommitdiffstats
path: root/httpd/cgi-bin/referers
blob: e8abf5495a892c5cd71ae79d92f8a09af6a2ebc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
#
# referers: CGI script to show the top referers of the 50,000 most recent
# hits to this server.
#
# This source code is available under the license at:
#     http://www.w3.org/Consortium/Legal/copyright-software
#
# $Id: referers,v 1.8 2000-05-08 02:12:31 gerald Exp $

LOG=/usr/local/apache/logs/validator_log; export LOG

cat <<EOHD
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<title>top referers to validator.w3.org</title>

<body bgcolor="#FFFFFF" text="#000000" link="#0000ee" vlink="#551a8b">

<p>
  This page lists the top 100 referers to <a href="/">the W3C Validation
  Service</a> (taken from the most recent 50,000 log entries.)
</p>

<table>
EOHD

tail -50000 $LOG | egrep -v image/png | egrep -v image/gif | \
    cut -d\" -f4 | sort | uniq -c | \
    grep -v ' \-$' | sort -rn | head -100 | sed 's/\&/\&amp;/g; s/</\&lt;/g' | \
    awk '{printf("<tr><td>%s</td><td><a href=\"%s\">%s</a></td></tr>\n",\
        $1, $2, $2)}'

cat <<EOHD
</table>

<hr>
<address>
<a href="http://www.w3.org/People/Gerald/">Gerald Oskoboiny</a><br>
\$Date: 2000-05-08 02:12:31 $ \
</address>

EOHD

exit