News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

php|architect:
Writing an AJAX-based Visual Rating System with PHP
June 13, 2006 @ 06:06:48

In php|architect's ART respository today, there's a new article from Marco Tabini himself about the creation of an Ajax rating system for your site.

A rating system is a great tool for any website. It serves two important purposes: first, it gives your users a way to interact with your pages-and interactivity is an important aspect of any website these days. Second, it provides you with a valuable feedback tool that you can use to gauge viewer interest in individual areas of your site. In other words... everybody wins!

He explains the concept behind the system before ever getting into any code - a visual representation of the rating users are giving a particular article/posting. With that out of the way, he gets into the HTML first, explaining how the table is laid out before giving the code to pull together the images and form one seamless one representing the correct rating. He also demonstrates the use of a "secret hash" to protect the script against abuse.

Next up, he creates the PHP/SQL backend to handle the Ajax requests coming back in from the page, and setting a cookie to protect (somewhat) against more than one vote. Finally, he gives the Javascript you'll need to create the Ajax connection and relay the JSON message back to the server on the rating the user chose.

Of course, the code is available for download as well.

0 comments voice your opinion now!
ajax visual rating system mysql cookie gd hash ajax visual rating system mysql cookie gd hash


blog comments powered by Disqus

Similar Posts

ZendCasts.com: Ajaxify Your Zend_Form Validation with jQuery

SANIsoft Blog: The longer Lithium Blog tutorial using MySQL – Part 1

SomeCoders.com: Member Managment System Using PHP, AJAX and script.aculo.us (Part 1)

Michael Dowling: Favor Hash Lookups Over Array Searches

DeveloperTutorials.com: How to Install PHP 5 on Linux


Community Events





Don't see your event here?
Let us know!


opinion package release framework interview voicesoftheelephpant symfony tips introduction bugfix language community series list library install deployment laravel api podcast

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework