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.
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).
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.
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
Which attribute can be used to add CSS styles directly in the HTML tag? type style class
<div style="width: 80%; border: 3px solid #888888;">Content</div>
Which CSS transform method distorts the HTML element in a given angle (including its content)? translate() scale() skew()
transform: skew(20deg, 25deg);
-ms-transform: skew(20deg, 25deg); /* IE 9 */
-webkit-transform: skew(20deg, 25deg); /* Safari and Chrome */
Click on the function which converts a Date object to a string. indexOf() toString() getDate()
var rightnow = new Date();
alert( rightnow.toString() );
Which function applies a callback function to the elements of the given array? array_merge() array_search() array_map()
$arr = arra("abc", "<p>xyz</p>", "<em>PHP</em>");
// apply the strip_tags() function to delete HTML tags from each array item
$arr = array_map("strip_tags", $arr);