This is a Free Voting Script that allow users to vote Up /Down on content, or to simple add and display points /votes for images, articles, videos, games, or any element in pages of your web site.
The votes for each element can be saved in TXT files on the server, or in a MySQL database (using PDO).
The voted item, the number of the day, and the user (name or IP) are saved on the server, and cookies, so, the user can vote again the next day.
You can use the script to add rating system to one or more elements in a web page.
If you have a register /login script in your web site, you can set this Voting Script to allow only the logged users to vote. By default, all the visitors can vote an element once to 24 hours.
It has been tested successfully on Mozilla Firefox, Internet Explorer, Google Chrome and Opera.
- Details about Installation and Settings you'll find in a "Read.html" file, in the archive with the script.
• To Download it, click: Ajax-PHP Voting Script - Vote Up /Down.
Demo (here's an example with the three models of voting system that you can create with this script):
Free Vote Up /Down.
Vote Up /Down (or Plus /Minus), that shows Total Votes, and Current Rating
. The vote can be Up (increase), or Down (decrease).
Free Up /Down Voting Script.
Up /Down (or Plus /Minus) vote system, that shows Current Rating, and the Number of Up and Down votes
Simple Voting Script.
Simple vote to add /show points.
• If the votes are saved in MySQL database:
To create a list which ranks the score of multiple voted items, based on highest score (or points), perform a MySQL Select in the "voting" table. This table stores the voted items (in "item" column), total points (in "vote" column), and number of votes (in "nvotes" column).
SELECT `item`, `vote`, (`vote` / `nvotes`) AS `score` FROM `voting` ORDER BY (`vote` / `nvotes`) DESC LIMIT 10
• If you want to use this Voting Script in pages that are in different folders, open the "voting.js" file (in "votingfiles" directory), and add the domain name to the value of the votingfiles variable (line 6); to use the absolute path.
var votingfiles = 'votingfiles/';
Edit to be:
var votingfiles = 'http://domain_name/votingfiles/';
- Also, be sure to have in each page the correct path to the "voting.css", and "voting.js" files, included in the <head> area of the HTML code.