This is a Free Voting Script that allow users to vote Up /Down (Plus /Minus) 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 are saved in a MySQL database, using MySQLi (or 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 per day.
It has been tested successfully on Mozilla Firefox, Internet Explorer, Google Chrome and Opera.
- Details about Installation and Settings you'll find in a "readme.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.

• To create a list which ranks the score of multiple voted items, based on highest score (or points), perform a MySQL Select in the "votitems" table. This table stores the voted items (in "id" column), Up votes (in "v_plus" column), and number of Down /Minus votes (in "v_minus" column).
Example:
SELECT id, (v_plus - v_minus) AS score FROM votitems ORDER BY score DESC LIMIT 10

• If you not put the "voting_mp" folder in the Root of your site, open the "voting.js" file (in "voting_mp" directory), and add the domain name to the value of the voting_mp variable; to use the absolute path.
Instead of:
var voting_mp ='/voting_mp/';
Edit to be:
var voting_mp ='http://domain_name/voting_mp/';

- 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

HTML
CSS
JavaScript
PHP-MySQL
Which HTML5 tag defines marked text? (can be used to highlight parts of text)
<mark> <embed> <span>
<p>Free corses: <mark>coursesweb.net</mark> for Web Development.</p>
Which CSS pseudo-class adds a style to an element when the mouse is over it?
:focus :hover :active
a:hover {
  font-weight: bold;
  color: #00da01;
}
Click on the function which returns a string value that represents the number rounded to the x digits after the decimal point.
toPrecision(x) toFixed(x) floor(x)
var num = 12.34567;
num = num.toFixed(2);
alert(num);       // 12.35
Indicate the PHP function which reads an entire file into an array.
[) file() readfile()
$arr = file("a_file.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
var_export($arr);
Ajax Voting Script - Vote Up Down

Last accessed pages

  1. Classic Tween - Flash Animation (4192)
  2. CSS Course - Free lessons (8811)
  3. querySelector and querySelectorAll (7400)
  4. Extract a number of characters and words from text (566)
  5. Create simple Website with PHP (20257)

Popular pages this month

  1. Insert, Select and Update NULL value in MySQL (489)
  2. Read Excel file data in PHP - PhpExcelReader (443)
  3. PhpSpreadsheet - Read, Write Excel and LibreOffice Calc files (426)
  4. Get Attribute (ID, Class, Name, Title, Src) with jQuery (367)
  5. PHP getElementById and getElementsByTagName (304)