
--- Accessible ASP Star Ratings ------------------------------------------------
    Version 0.2
    7th October 2006

    Copyright Chris Hardy
    http://www.chrishardy.co.uk/
--------------------------------------------------------------------------------

I'm sure you've seen the star ratings dotted about the web on sites like Amazon
and YouTube. I couldn't seem to find a ready made ASP script for this anywhere
so I decided to make one myself.

I wanted this script to be accessible so if javascript is enabled the prettier,
AJAX version will run. If the user has javascript disabled the script will still
function in exactly the same way, albeit with a page refresh.

This is still in development so the code is a bit sloppy and there may be things
I haven't thought of. For a start, if a page changes content based on the
querystring, the script will still display the same rating for every page. This
will be fixed in the next version.

If you find any bugs, please let me know and I'll make sure they're fixed in the
next version.


--------------------------------------------------------------------------------
  Installation instructions
--------------------------------------------------------------------------------

Extract this .zip file above to a directory named "rating" in the root directory
of your website.

Add the following code between the <head> tags of your page:

    <script type="text/javascript" src="/rating/rating.js"></script>
    <link type="text/css" rel="stylesheet" href="/rating/rating.css" />

Add this code wherever you want the rating bar to appear on your page:

    <!--#include virtual="/rating/rating.asp"-->

No further setup is required for this script to run "out of the box". However I
can't stress strongly enough that you MUST upload to the "/rating/" directory to
the ROOT DIRECTORY of your website. If you upload the files to anywhere else
then the script won't work without further changes (see below).


Database
---------------------------------------

This script uses a Microsoft Access 2000 database, included in the .zip file.
By default the database is located in the "/rating/" directory with all of the
other files and as such could be downloaded by anyone. Since the database
probably won't contain any sensitive data this shouldn't be a problem.

However, if you would like to store the database outside the web root then
alternative connection strings are provided in common.asp.


Uploading the script to a directory other than "/rating/"
---------------------------------------

If you want to store the files in a directory other than "/rating/", for example
"/scripts/rating/", you will need to edit the RATING_DIR constant in common.asp
as follows:

    RATING_DIR = "scripts/rating"  '- DO NOT start or end with /

You will also need to edit the image paths in rating.css as follows:

    #star-rating ul {
      background: url(/scripts/rating/rating.gif) top left repeat-x;
    }
    #star-rating li.current-rating {
      background: url(/scripts/rating/rating.gif) left bottom;
    }
    #star-rating li a:hover {
      background: url(/scripts/rating/rating.gif) left center;
    }

Change the path to the CSS and Javascript files between the <head> tags of your
page:

    <script type="text/javascript" src="/scripts/rating/rating.js"></script>
    <link type="text/css" rel="stylesheet" href="/scripts/rating/rating.css" />

And finally change the include path to the rating script:

    <!--#include virtual="/scripts/rating/rating.asp"-->


Blocking IP Ranges
---------------------------------------

Open common.asp and scroll down to the "Blocked IP Ranges" section. To block an
entire IP range use the AddBlockedIPRange subroutine as shown below and replace
the lower and upper IP addresses as required:

    AddBlockedIPRange "192.168.0.1", "192.168.0.10"

An excellent list of search engine IP addresses and User Agents can be found at
[http://www.iplists.com/]


Blocking User Agents
---------------------------------------

Open common.asp and scroll down to the "Blocked User Agents" section. To block a
User Agent, use the AddBlockedUserAgent subroutine as shown below:

    AddBlockedUserAgent "Googlebot"
    AddBlockedUserAgent "MSNBOT/0.1"

A helpful list of robot and search engine User Agents can be found at JafSoft
[http://www.jafsoft.com/]


Blocking User Agent Strings
---------------------------------------

As well as blocking specific User Agents, you can also block User Agents that
contain certain strings, such as "crawler" or "spider".
Open common.asp and scroll down to the "Blocked User Agent Strings" section. To
block User Agents containing a certain string, user the AddBlockedUAString as
follows:

    AddBlockedUAString "crawler"
    AddBlockedUAString "spider"


--------------------------------------------------------------------------------
  History
--------------------------------------------------------------------------------

28th September 2006 -- VERSION 0.2

  * Features added:
    Block voting by IP range
    Block voting by User Agent
    Block voting by strings contained in the User Agent
    Works with dynamic URLs

  * Made changes to accommodate the AJAX framework found at Cyclomedia, found at
    [http://www.cyclomedia.co.uk/?27]

	* Subroutines added:
    AddBlockedIPRange
    AddBlockedUserAgent
    AddBlockedUAString

  * Functions added:
    BlockedUserAgent
    WithinBlockedRange
    BlockedUserAgentString
    NearestHalf
    QuerystringAppend
    QuerystringRemove

  * Functions removed:
    ProperDate
    ProperTime


--------------------------------------------------------------------------------
  Copyright & Credits
--------------------------------------------------------------------------------

Feel free to use this code for any commercial or non-commercial purposes. The
only thing I won't allow is for you to redistribute this code as your own.

If you'd like to link to my site then please do, I'd be very grateful. If you
don't want to, no big deal. If you're using this script on your site and you'd
like me to link to you, let me know and I'll add a link from the demo page.

The XHTML/CSS has been taken from "Creating a Star Rater using CSS" written by
Rogie King at Komodo Media [http://www.komodomedia.com/].

The AJAX framework used by this script is the Simple/Basic AJAX Framework by Ric
Hardacre at Cyclomedia [http://www.cyclomedia.co.uk/].

Enjoy!
