LinkBanner.pm - Respond for CGI as the link banner image or the links page of referers

Access counter


NAME

LinkBanner.pm - Respond for CGI as the link banner image or the links page of referers

$Id: LinkBanner.pm,v 1.6 2002/04/11 15:06:57 T.Shigetome Exp $


SYNOPSIS

This will respond a banner image and will log referer address. That referer information is used for to make links list.

        use LinkBanner;
        my($banner) = new LinkBanner("/home/foo/public_html/log_path/");
        $banner->RecordLog();
        $banner->OutBanner("/home/foo/public_html/cgi-bin/testbanner.jpg");
        use LinkBanner;
        my($banner) = new LinkBanner("/home/foo/public_html/log_path/");
        $banner->deny("/home/foo/public_html/deny_list.txt");
        $banner->OutLinkPage();


DESCRIPTION

This will automatically create link page. If some web contents reference to CGI program is useing this module, that will respond banner image. At that time also this module will be logging address of reference page. When required links page, this will generate from that logged file.

METHOD

new([$logpath ,$query])
Create instance.
        my($banner) = new LinkBanner;

or

        my($logpath) = "/home/foo/public_html/log_path/";
        my($banner) = new LinkBanner($logpath);

or

        my($logpath) = "/home/foo/public_html/log_path/";
        my($query) = new CGI;
        my($banner) = new LinkBanner($logpath,$query);

RecordLog($logpath)
Record referer information to file.
        $banner->RecordLog();

or

        $banner->RecordLog(C<$logpath>);

OutBanner($img_file [,$lifetime ,$basetime])
Output specify banner. The $img_file specify file of banner image.

The $lifetime specify period of cacheing banner image. The $basetime specify created time of banner image. That banner image will be expired at $basetime + $lifetime. These arguments override default value.

        $banner->OutBanner("/home/foo/public_html/image.gif");

OutLinkPage([$ra_sorteddata, $rs_template])
Output the links page that will be made from logged file. The $ra_sorteddata is reference of logged data array. The $rs_template is reference of template that is used for page of links. These arguments override default value.
        $banner->OutLinkPage();

deny($filename)
Set filename that is described about denied link address. It is used for eliminate referer address. Each line of that file is joined by `|', and eliminate matched address. Will be escaping by `\' automatically, if it need.
        $banner->deny("/home/foo/public_html/deny_list.txt");

Example describe denied link address

        http://localhost
        http://www.denied.com

debug($debug_opt)
Set debugging option.
        $banner->debug('template');

Message of debugging will be outputted to STDERR. Also. you can log by redirect STDERR with debuglog.pl or another way.

When you terminate debugging, you can strip debugging code from this module. All of debugging code are between line of `#>>>DEBUG_CODE'. These are able to strip by striper.pl.

query
Debug about parse of CGI query string.

sortedlist
Debug about making of cache link file.

ignore
Debug about filtering record.

template
Debug about expanding of template.

escape
Debug about escaping of the CGI parameters.

logfile
Debug about logging.

GetTemplateOfLinkPage([$rs_buffer, $template,])
Get template of links page. In default locate `template.html' as template file in logging file path.

The $rs_buffer specify reference of template buffer that used as argument of OutLinkpage. The $template specify filename of template.

Require modules

strict.pm, Carp.pm, File::Basename, URI::Escape, CGI Timestr.pm, regexpr.pl, jcode.pl

How to append link banner to web contents

Describe as following to your Web contents.

        <IMG SRC="http://www.any.com/~foo/cgi-bin/linkbanner.cgi?title=title%20of%20your%20page;topic=topic%20of%20your%20page" ALT="Link banner">

You must adjust to your page about `title%20of%20your%20page' and `topic%20of%20your%20page' fields. Don't use HTML tag.

Locate template file of links page

Locate `template.html' as template file in the log file path.

Example template.html ...

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01/EN">
        <HTML lang="ja">
        <HEAD>
        <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Shift_JIS">
        <TITLE>Links page</TITLE>
        </HEAD>
        <BODY>
        <H1>Links page</H1>
        <HR>
        <TABLE border="1" cellspacing="0">
        <THEAD>
        <TR>
        <TH>Title</TH><TH>topic</TH>
        </TR>
        </THEAD>
        <TBODY>
        <!--
                Following comment statements will be replaced to link list.
                You can customize that.
                These keywords will be handled about specified link banner parameter.
                Like as...
                %referer% : URL of linked content that will reference the link banner.
                %title%   : Title of linked page
                %topic%   : Topic of linked page
        -->
        <!-- __Links_Replace_to_Here__ 
                <TR><TD><A HREF="%referer%">%title%</A></TD><TD>%topic%</TD></TR>
        __Links_Replace_to_Above__ -->
        </TBODY>
        </TABLE>
        <HR>
        </BODY>
        </HTML>


AUTHOR

Tetsuya Shigetome, <t_shigetome@muf.biglobe.ne.jp>.


HISTORY

$Revision: 1.6 $
$Log: LinkBanner.pm,v $ Revision 1.6 2002/04/11 15:06:57 T.Shigetome

o Simplified filter rouitne

o Change using module from timestr.pl to Timestr.pm

Revision: 1.5
Revision 1.5 2002/03/25 14:43:15 T.Shigetome Sorry I miss update log in Rev. 1.4.

Fixed bugs

o Sort order is not numericaly.

o Delete new record in FilterSimpleDuplicated.

Revision: 1.4
Revision: 1.3
Log: LinkBanner.pm,v Revision 1.3 2001/07/30 09:38:31 shige

Fixed problem

o Log file grow too big.

Revision: 1.2
Log: LinkBanner.pm,v Revision 1.2 2001/03/13 15:27:06 shige

Fixed bugs

o Duplicate default references.

o Jammed unescaped argument.

o Stricts match expression, so it need change of replace keyword.

Some warning miss match to debug option.

Revision: 1.1
Log: LinkBanner.pm,v Revision 1.1 2000/12/20 14:41:39 shige

First release of LinkBanenr

 LinkBanner.pm - Respond for CGI as the link banner image or the links page of referers