Rating System PHP AJAX and SQLite

Overview

 

Version 1.2

Changes in v1.2:
 – Improved XML file creation.
 – Two additional graphic versions.

Description

This rating system is written in PHP. It uses AJAX, PHP session and SQLite. After clicking “the hand”, the vote is recorded in file-based database. Your site is not reloading. If you have already voted for this article / post, your vote can not be saved (in this PHP session). Tested in IE, Firefox and Chrome.

 

Features

  • Easy to implement
  • No site reloading
  • You do not need a database – it is a single file (SQLite Data Base)
  • You can change the text displayed to the user
  • Nine graphic versions
  • You can change the appearance of this (color, height, fonts, etc.) in the css file

 

Included

  • php files in 9 folders – 9 different graphic versions
  • in directory “docs” – pdf file how to implement, with image illustration and an example of the implementation

 

Requirements

  • PHP 5.3
  • support for SQLite in PHP (it is enabled by default in most cases)

 

Instructions

How to implement?
1. Download and unpack the zipped files. Select folder with graphic version, that you like, for example “rating_a”.
2. Then you must put the folder “gravedgRating” into folder with your website.

Your website must have the extension “.php”.
3. Put the following lines of code into your site:
a) The first line of the code of your page:
session_start ();
?>
b) In the “head” section:

c) In the “body” section, in places where voting should be visible:
$ ArticleID = “12345”;
include ‘gravedgRating/ratingJS.php’;
?>
That’s all.

See the pdf file how to implement, with image illustration and an example of the implementation, in folder “docs”.

Each time you calling the script, you must give another identifier (“$ articleID”). “12345” is an example identifier. You can do it in a loop, writing (for example) 10 posts from users.

The text displayed to the user, and path to your database, you can change in “rating.php” file.

There are nine different graphic versions of this script. They are compressed in nine different directories (“rating_a”, “rating_b” and so on…). Use the one that you like.

In addition, the database is stored the user’s IP and time of voting. You can see it using i.e. free program “sqliteAdmin” from Internet.

Related