Home arrow DHTML arrow Page 3 - Completing a Noisy Image Application

Completing a Noisy Image Application

If you're searching for an approachable guide on how to build noisy images to help prevent automated submission of online forms, then look no further. Welcome to the final article of the series "Building Noisy Images." Over the course of this instructive series, you'll learn different approaches for including this kind of image quickly into your own web sites by using only a simple combination of basic markup and CSS styles, along with the assistance of PHP.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 5
May 16, 2007
  1. · Completing a Noisy Image Application
  2. · Reviewing the partial source code of the noisy image application
  3. · Defining a basic session handling PHP class
  4. · Completing the noisy image application

print this article

Completing a Noisy Image Application - Defining a basic session handling PHP class
(Page 3 of 4 )

As I explained, the only missing piece of this noisy image application is a session mechanism that allows us to save the four-digit random values to a plain variable, so they can be properly checked on the web server after a web form has been submitted.

Fortunately, the mechanism can be easily implemented by creating a simple session handling PHP class. This class must provide at least some basic functionality, including the ability to register and deregister session variables, create and destroy a particular session, and so forth.

Having explained how random values will be handled via a session handling PHP class, please pay attention to its signature, which is shown below:

class SessionHandler{
   function SessionHandler(){
   function setVariable($value='default',$varname='challenge'){
   function getVariable($varname='challenge'){
       trigger_error('Error getting session
     return $_SESSION[$varname];
   function destroy(){

After examining the definition of the above "SessionHandler" class, certainly you'll have to agree with me that its intrinsic logic is very easy to grasp. As you can see, this class presents a few basic methods for registering and deregistering session variables, and destroying an existing session as well. Quite simple, right?

Obviously, in the context of the noisy image application that I'm currently developing, the previous session handling class fits perfectly. In this case it's not necessary to create a complex session-related mechanism to save the generated random strings to a plain variable.

So far, so good. At this point, I have shown you the signature of the brand new "SessionHandler()" class, which admittedly is pretty straightforward. However, I'd like to demonstrate how this class can be properly linked to the noisy image script that was listed in the previous section, in this way completing the application itself.

Thus, in the final section of this article I'm going to make available for you the full source code corresponding to this noisy image application, this time including the basic session handling class. Please click on the link below and keep reading.

blog comments powered by Disqus

- Text-Justify, Volume, and Other Style Sheet ...
- Ruby-Position, Size, and Other Style Sheet P...
- Padding, Pages, and More Style Sheet Propert...
- Marks, Orphans, and More Style Sheet Propert...
- Layouts, Margins, and Other Style Sheet Prop...
- Floats, Fonts, and Other Style Sheet Propert...
- Color, Filters, and Other Style Sheet Proper...
- Borders and More with Style Sheets
- Learning Style Sheet Properties
- Style Sheet Property Reference
- Completing a Noisy Image Application
- An Object-Based Approach to Building Noisy I...
- A Basic Method for Building Noisy Images
- Adding More Features to Sliders with the Scr...
- Using Sliders with the Scriptaculous Framewo...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials