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.
This Voting Script is made using Ajax technology, with JavaScript and PHP (with OOP), it can be included in any page (".html", or ".php"), but the server must run PHP.
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.
Instead of:
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.

Daily Test with Code Example

Which attribute is used in <a> tag for the address of the link?
src href rel
<a href="" title=""></a>
Which CSS property sets the type of the text font?
font-family text-decoration font-size
h2 {
What instruction selects all the <div> tags with class="cls"?
querySelector("div.cls") getElementsByTagName("div") querySelectorAll("div.cls")
var elm_list = document.querySelectorAll("div.cls");
var nr_elms = elm_list.length;       // number of selected items
Indicate the function that can be used to get the sum of values in an array.
array_sum() array_diff() array_shift()
$arr = array(1, 2, 3, 4);
$arr_sum = array_sum($arr);
echo $arr_sum;       // 10
Ajax Voting Script - Vote Up Down

Last accessed pages

  1. Ajax-PHP Chat Script (18178)
  2. SHA512 Encrypt hash in JavaScript (2417)
  3. PHP-MySQL free course, online tutorials PHP MySQL code (22759)
  4. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (27121)
  5. JSON syntax in JavaScript (2253)

Top accessed pages

  1. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (27121)
  2. PHP-MySQL free course, online tutorials PHP MySQL code (22759)
  3. Get Attribute (ID, Class, Name, Title, Src) with jQuery (22218)
  4. Read Excel file data in PHP - PhpExcelReader (19923)
  5. PHP PDO - exec (INSERT, UPDATE, DELETE) MySQL (19243)