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 indicates that an input field must be filled out before submitting?
required="required" autofocus="autofocus" placeholder="text"
<input type="text" name="name1" required="required" />
Which CSS method increases or decreases the size of the HTML element (including its content)?
translate() scale() skew()
#some_id:hover {
  transform: scale(2, 1.5);
  -ms-transform: scale(2, 1.5);    /* IE 9 */
  -moz-transform: scale(2, 1.5);   /* Firefox */
Click on the Date object method that returns the day of the month.
setDate() getMonth() getDate()
var rightnow = new Date();
var day = rightnow.getDate();
Which function is used to upload a file on server?
is_file() move_uploaded_file() fopen()
if(move_uploaded_file($_FILES["field_name"]["tmp_name"], "dir/file_name")) {
  echo "The file succesfully uploaded";
Ajax Voting Script - Vote Up Down

Last accessed pages

  1. Volume and Surface Area Calculator for 3D objects (2352)
  2. Keep data in form fields after submitting the form (2655)
  3. Detect when ScrollBar reaches the bottom of the page (967)
  4. Working with getElementById (4791)
  5. HTML object and param (4471)

Top accessed pages

  1. PHP-MySQL free course, online tutorials PHP MySQL code (16440)
  2. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (16052)
  3. Get Attribute (ID, Class, Name, Title, Src) with jQuery (15357)
  4. Ajax-PHP Chat Script (13566)
  5. PHP PDO - exec (INSERT, UPDATE, DELETE) MySQL (13530)