WebCounter 2.0

Introduction

  A very simple web site access counter, whose client side is an small applet invoking
  the server side (CGI/Perl) script once a time then drawing the counter image as faster
  as server responds or images availability. Counter image can be fully rendered by
  applet on connection faults or as a convenience to user.
  All source code is available with comments.

Why to use ?

  * Safe to use since script/applet be properly adjusted.
  * Encapsulates site information turning SSI call unnecessary.
  * No hacks or ads! None must know about yours visitors; only you.
  * Applets work in any client platform with Java support.
  * Applet always renders some image. No annoying gray box.
  * Prevents access recounting with time criterion.
  * Lock/Unlock data files for accurate access registration.
  * Customizable appearance! Counter image will fit your site as you desire.
  * Original CGI script in Perl, but you can use other of your choice.
    Remember: Perl is one of the most powerful script languages!
  * A good alternative if you haven't JSP.
  * Small source codes and applet bytecode assure fast and accurate execution.
  * Easy to modify and deploy! A good example to newcomers!
    (I tried to comment all details)
  * Source code is FREE! Would you prefer to pay ? (LOL)

What you need to implement counter scheme?

  * Host server must to have Perl 5.0 or higher implemented if intended
    to run WebCounter.pl or other Perl script.
    Get free Perl documentation and download from http://www.activestate.com/.
  * Any other script producing the same result of WebCounter.pl, as
    plain/text.
    It just returns access number and background filename.
  * Java compiler, any version, any brand mark.
    Free download Java SDK and more from http://java.sun.com/.
  * If no default drawing wanted (user customization):
    + Images folder must to be child of applet/script folder, for
      simplicity and ease of maintenance.
    + A set of homogeneous background images (GIF/JPG any size) if random
      choice wanted. This random choice is just to reduce tedious appearance.
    + A set of homogeneous digits images of your choice.
      I suggest you to visit http://www.digitmania.holowww.com/.

How to implement

  * Wherever you find "YourDomain" string replace properly.
    Example: http://www.Domain_Name.com/ for applet source and for script
    source (referrers list) put @referers = ("Domain_Name.com");
    and please: Don't Forget Trailing Slash Bar!
  * In script, change server time zone and user time zone to proper GMT values.
  * Compile original applet source code WebCounter.java with target 1.1 parameter.
    It warrants good function on many browser versions (NE 4.0+, MSIE 5.0+ or
    HotJava).

      prompt>javac -target 1.1 WebCounter.java

    I suggest to "jar" generated bytecode, it dramatically reduces
    download time.

      prompt>jar cvf WebCounter.jar WebCounter.class

    Applet bytecode not available for your convenience (not mine), because
    we don't want to expose script filename, child folders or other
    internal info about site.
    That info will be encapsulated in applet.
  * Applet parameters:
    + backColor: applet background color in hexadecimal without prefix,
      i.e.; "#FF12BB" would be "FF12BB".
    + intraGap: distance between digits images.
    + defDrawing: a "true" value will cause default drawing method (don't
      need any image), else user must to provide all possible images.
    + leftIndent: left side visual indentation for digits image set, or
      where to begin drawing digits.
    + fontName: font name if using default drawing.
    + fontSize: font size of this declared font.
  * Create Images and Data folders as child folders of applet/script folder.
  * Site using WebCounter scheme: http://temis.hypermart.net/
  * I checked all with care and it is about to use.

Known Problems

  * Visitor's browsers must to have Java enabled. Trap the applet tag to
    warn visitors.
  * Next Microsoft Windows version will not offer Java installed, so, in
    near future give to yours visitors a chance to download Java plug-ins.
  * Character fonts always display differently for each platform. Check
    with care if you gonna use default drawing.
  * A fatal error would occur if there werent lock commands implementation
    on host server system. Discard lock command if so, just commenting 
    command lines.

Important

  All source code is for free since you maintain all references about
  authorship and never sale the code, yet partially or modified.
  You can modify, freely distribute and make money with maintenance, or
  copy service.
  Let me know about your success, send me a mail if you can,
  nevertheless, rarely I will reply because I have no time and funds for
  support.

  "This was made to enhance newcomers skills, not for simple joy".

  I sincerely hope this helps you to learn more about Perl/CGI/Java.

  LazyDog Concepts can be reached at http://www.lazydog.hpg.com.br/.