The basic idea of this rating script is to count the number of votes and the ratings and store them in a text file (a database could also be used).
The first step was to create some images to represent the ratings. The easiest approach was to use ImageMagick to create colorful asterisks.
Finally, the PHP was written and tested. It is listed below.
In a production environment, some CAPTCHA or other tool should be used to prevent automated submissions.