Version 2 is a complete overhaul. Also some issues solved
now.
Version 2.1+ supports more than 1 voting block on 1 page! Version 2.2+ supports voting classes
A simple Rating system for files / pages / photo's and whatever
you want to use it for.
Simplicity always wins. This small script let visitors rate
on a scale you like. (1-5 , 1-10, exellent-rubbish)
Results are displayed also number of ratings can be displayed and the
average rating in a number or as stars.
Supports as many voting blocks on a page as you
like!
I added an admin section which made it obligatory to create
an id-number first before you can use it in ratings. You can also delete/change
id's or their description.
The description is what it is, a short description of the page reference
/ foto name and so on.
I added a cookie as an extra security against double voting
(jacking up).
So if cookies are blocked the ip still will block.
Based on ip is not enough as dial up connections have different ip's on
every connection.
The period in which you cannot vote for the same item is configured in
the variable $days.
It is standard set to 2 days, you want more set it to 7 or so (1 week)
Another addition is an optional link to Hotscripts voting.
Just enter the hotscript_id of your script in ShowForm. In rateit.php
you find this inclusion marked.
Via includes very easy to include in pages.
ShowForm($id,$num,$rate_me="Select Rating",$rate_it="Rate!",$class="",$hotscript_id="") shows the voting form the last parameter is the hotscript link
ID
NumRates($id) returns the numer of votes
ShowResult($id) returns the average result
ShowStars($id) shows the number of stars (half stars included)
All together it is what you see below (and can use to rate too).
The administrtion is called with rateit_adm.php and is presently unprotected
(move it out to another dir if you want to use .htaccess). Don't forget to edit
the config.php file.
In this sample there is a link to hotscripts to, in order to vote on this script
and pass it on to hotscripts too. 12/3/03 CHANGES: Added javascript
warning if no rating selected.
Admin section changed, now bugfree. 23 May /2004 Version 02
Number of choices can be set in config.
Cookie problem solved.
Top 10 of scores included (rate_top10)
Added url to admin, so top 10 includes page url's.
Warning if you already voted. 5 June 2004 Version 2.2
Added classes for voting.
Changed voting registration. Votes are now cummulated.
Smaller table when many votes. 5 December 2005 version 2.3
Now all colors/text configurable via css file 19 April 2006 version 2.4 Solves sql injection vunurability and changed
hotscripts popup
Bear in mind that if you include all in a page, the inclusion of: include("path-to-rateit/rateit.php")
should be at the very top of your PHP page. Otherwise no cookie
will be set!
Like on this page. Do not cache the page either, as rating changes the content.
As i found out Hotscript reads the page variables from _POST.
So as small trick was needed to establish that since i only can refer to the
link with _GET's.
I created hotscript_dummy.php which is nothing more than a form that sends itself
via javascript.
It sends the required data to Hotscript via _POST and in the popup window.
If you dont want the hotscript link replace the hotscript-id with '' and your
done.
Version 2.3 Has all text/colors configurable via css file.
This allows for different layout in different sections of your site.