DHTML
  Home arrow DHTML arrow Page 3 - Completing a Noisy Image Application
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DHTML

Completing a Noisy Image Application
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2007-05-16

    Table of Contents:
  • Completing a Noisy Image Application
  • Reviewing the partial source code of the noisy image application
  • Defining a basic session handling PHP class
  • Completing the noisy image application

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    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(){
         session_start();
       }
       function setVariable($value='default',$varname='challenge'){
         $_SESSION[$varname]=$value;
       }
       function getVariable($varname='challenge'){
         if(!$_SESSION[$varname]){
           trigger_error('Error getting session
    variable',E_USER_ERROR);
         }
         return $_SESSION[$varname];
       }
       function destroy(){
         session_start();
         session_unset();
         session_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.

    More DHTML Articles
    More By Alejandro Gervasio


       · In this final article of the series, the noisy image application is completed. This...
     

    DHTML ARTICLES

    - 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...






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT